You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The doc of sentry-go already tells how to integration sentry-go with open telemetry sdk, but there is something wrong with this setup that sentry UI keeps losing the context of open telemetry traceID (it records both traceID from otel and its random traceID, and the error event somehow belongs to the unknown traceID).
Expected behavior
When I used client.CaptureException, this exception will be reported to Sentry, along with a trace and a spanID. With the integration with Opentelemetry, I expect this traceID is also a valid traceID in Opentelemetry (in my case it's Jaeger), but this is not. After debugging, it is the traceID generated by this code: sentryhttp then calls StartSpan
I have played around a bit and found a setup that worked:
inside otelhttp middleware, it call tracer.StartSpan, which will trigger sentrySpanProcessor to creates a mapping between otelID (newlycreated) and a transaction its create internally. And as i read the code, there is only one method that allowing my code to get back that transaction, that is via sentryotel.NewSentryPropagator().Inject()
This looks quite hacky to me, because I have to look into the implementation to find out how it works, it would be nice if you can provide a fully working example
When I used client.CaptureException, this exception will be reported to Sentry, along with a trace and a spanID. With the integration with Opentelemetry like the code above, I expect this traceID is also a valid traceID in Opentelemetry (in my case it's Jaeger), but it is not. After debugging, it is the traceID generated by this code: sentryhttp then calls StartSpan
The library did create a "SentrySpan" containing the traceID of Opentelemetry via spanprocessor here, but the it is not saved into any context
Summary
The doc of sentry-go already tells how to integration sentry-go with open telemetry sdk, but there is something wrong with this setup that sentry UI keeps losing the context of open telemetry traceID (it records both traceID from otel and its random traceID, and the error event somehow belongs to the unknown traceID).
Expected behavior
When I used client.CaptureException, this exception will be reported to Sentry, along with a trace and a spanID. With the integration with Opentelemetry, I expect this traceID is also a valid traceID in Opentelemetry (in my case it's Jaeger), but this is not. After debugging, it is the traceID generated by this code:
![image](https://user-images.githubusercontent.com/35887761/221883903-4c2f12aa-b882-4f48-b823-4958bf72701b.png)
sentryhttp then calls StartSpan
I have played around a bit and found a setup that worked:
Quick explanation:
This looks quite hacky to me, because I have to look into the implementation to find out how it works, it would be nice if you can provide a fully working example
Full code
The text was updated successfully, but these errors were encountered: