Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add recordException helper function #431

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

pkanal
Copy link
Contributor

@pkanal pkanal commented Jan 13, 2025

Which problem is this PR solving?

Currently, error auto-instrumentation works well for uncaught errors but it is also useful to have a helper function that sends an exception span that can be called whenever needed for handled exceptions.

Short description of the changes

  • Added a recordException helper function that takes an error and creates an exception span for that error.
  • Update deprecated semantic attribute constants
  • Consolidate logic to format stack traces

How to verify that this has the expected result

  • Tests pass

@pkanal pkanal requested a review from a team as a code owner January 13, 2025 16:30
Tracer,
} from '@opentelemetry/api';
import {
ATTR_EXCEPTION_MESSAGE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just checking, but the attribute keys would remain the same right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes they're the same! just a different variable name!

Copy link
Contributor

@jairo-mendoza jairo-mendoza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything looks great!

@pkanal pkanal merged commit bda615f into main Jan 14, 2025
16 checks passed
@pkanal pkanal deleted the purvi/record-exception-function branch January 14, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants