-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
http.route
missing from spans after enabling Sentry with OTEL
#14660
Comments
Hi, we need to narrow this down a bit (unless you happen to be able to provide repro). Is the route attr that is missing related to express or nestjs? I am wondering if we are stomping the options of one of the instrumentations you provided. |
Hello, it's an express API. IMO you should find the actual code doing it in https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts#L175-L183 Let me know if it helps. Thank you |
Thanks. Looking at our code, I cannot find any places relevant to this stack where we are overriding http.route 🤔 Would you mind providing a minimal repro example we could pull to reproduce this and debug more effectively? |
I'll try to prepare a repro example for you. |
Just looking at this again, one thing that is incorrect is that you have to opt-out of the Sentry SDK emitting spans, like this: Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.SENTRY_ENVIRONMENT || 'local',
release: process.env.BUILD_VERSION || 'local_version',
skipOpenTelemetrySetup: true, // We have our custom OpenTelemetry setup
registerEsmLoaderHooks: false,
beforeBreadcrumb() { return null; }, // Disable breadcrumbs
beforeSend(event, hint) {
// some stuff that doesn't affect this in any way
},
integrations: [Sentry.httpIntegration({ spans: false })]
}); You can see by cc @lforst we should probably flip this default in v9 too, so this is |
@mydea thanks for the idea. I just tested it and I don't see the |
So this is the correct/intended outcome then - the Could you also share your package.json? My best guess is that this has to do with some versioning stuff, e.g. the Sentry SDK has dependencies on various instrumentation packages, possibly those conflict with some versions you have (should not be the case but 🤷 package managers can be weird that way...) |
Ok, I found out |
Ok, after some more investigation this is what happens inside the internals of express and http instrumentations:
|
Ok, managed to fix this by swapping init order. |
Hmm, this is weird. Running |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.43.0
Framework Version
Node js 20.12.2
Link to Sentry event
No response
Reproduction Example/SDK Setup
First, we initialize sentry using:
Next, we initialize OpenTelemetry SDK using:
Steps to Reproduce
If you use the setup above, you'll have spans that look like following (coming from debug OpenTelemetry logs):
If I turn Sentry instrumentation off, there'll also be
http.route
, which is coming from OpenTelemetry express instrumentation.If I instrument OpenTelemetry before Sentry, it breaks the
ignoreIncomingRequestHook
defined above (i.e. it doesn't get called at all, probably overwritten by something from Sentry)Expected Result
The expected span would be something like the following (which I can get when I turn Sentry off):
you can notice the
http.route
at the end, that's what's missing.Actual Result
The text was updated successfully, but these errors were encountered: