-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Generate errors from OpenTelemetry data #31
Labels
Grooming
Backlog Grooming Candidate
Comments
Here's a basic JavaScript example to make this work. otelSpan.events.forEach(event => {
if (event.name === 'exception') {
const attributes = event.attributes;
if (attributes) {
const message = attributes[SemanticAttributes.EXCEPTION_MESSAGE] as string;
const syntheticError = new Error(message);
syntheticError.stack = attributes[SemanticAttributes.EXCEPTION_STACKTRACE] as string;
syntheticError.name = attributes[SemanticAttributes.EXCEPTION_TYPE] as string;
hub.captureException(syntheticError, {
captureContext: {
contexts: {
trace: {
trace_id: otelSpan.spanContext().traceId,
span_id: otelSpan.spanContext().spanId,
parent_span_id: otelSpan.parentSpanId,
},
},
},
});
}
}
}); |
@AbhiPrasad anyway this could be done server side? |
We don't attach this information in any way on spans (the sentry schema for spans has no concept for events), so currently no. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In OpenTelemetry, spans can have exception events.
Let's create Sentry errors from these exception events and send them to Sentry! We can link them to the parent transaction via trace context.
The advantage of doing this is that we'll get this working out of the box for users who already have errors instrumented with OpenTelemetry.
OpenTelemetry Exceptions
The text was updated successfully, but these errors were encountered: