Mark the email handler span as an error when it throws - #204
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughThe email instrumentation now exports Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This was referenced Aug 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
executeEmailHandlerinpackages/otel-cf-workers/src/instrumentation/email.tsrecords the exception on its span but never sets the span status, so it staysUNSET. A failed email invocation therefore does not read as failed: it carries an exception event but is not picked up by anything filtering on error status. The fetch handler, the alarm handler, and every storage binding already setERRORalongsiderecordException, so the email handler was the only one missing it.I found this by sweeping the instrumentation directory for files where the
recordExceptioncount and theSpanStatusCode.ERRORcount disagree, which is the same approach as #201 and #203. Email was the only remaining mismatch besides the queue consumer, which I have left alone since #203 is already touching that file.There was no test file for the email handler, so I added one covering the success path and the throwing path. It needed
executeEmailHandlerexported, which also lines it up withexecuteFetchHandlerandexecuteQueueHandlerthat are already exported and tested the same way. The throwing test fails on current main. Ran the repo preflight andpnpm run check, both green, and a patch changeset for@pydantic/otel-cf-workersis included.quick disclosure: built this with Claude Code's help and read the final diff myself. Freshman still finding my feet here, so say the word if you would rather not export the handler just for a test :)