fix: correct error span attributes for Datadog error tracking#120
Merged
fix: correct error span attributes for Datadog error tracking#120
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes error span attributes for Datadog error tracking by correcting the property check for Effect's TaggedError and ensuring span attributes are always strings.
Changes:
- Changed property check from
tagto_tagto correctly extract error type from Effect TaggedError - Wrapped
Cause.squashWithcalls inString()to ensure span attributes are always strings - Updated error handling in AMQP and NATS subscribers
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/nats/src/NATSSubscriber.ts | Fixed error.type extraction and wrapped error attributes in String() |
| packages/nats/src/JetStreamSubscriber.ts | Fixed error.type extraction and wrapped error attributes in String() |
| packages/amqp/src/AMQPSubscriber.ts | Fixed error.type extraction and wrapped error attributes in String() |
| .changeset/fix-error-span-attributes.md | Added changeset documentation for the fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Nice thanks @wewelll ! |
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.
Summary
Problem
When a handler in a subscriber returned an error, the onFailure handler was not correctly setting the error.type and error.stack span attributes for Datadog. Only error.message was being set.
The root cause was that the code checked for a tag property, but Effect TaggedError uses _tag as the property name.
Changes