Title: `http.route` missing from spans after enabling Sentry with OTEL · Issue #14660 · getsentry/sentry-javascript · GitHub
Open Graph Title: `http.route` missing from spans after enabling Sentry with OTEL · Issue #14660 · getsentry/sentry-javascript
X Title: `http.route` missing from spans after enabling Sentry with OTEL · Issue #14660 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/14660
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`http.route` missing from spans after enabling Sentry with OTEL","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/node\n\n### SDK Version\n\n8.43.0\n\n### Framework Version\n\nNode js 20.12.2\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\nFirst, we initialize sentry using:\n```ts\nSentry.init({\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT || 'local',\n release: process.env.BUILD_VERSION || 'local_version',\n skipOpenTelemetrySetup: true, // We have our custom OpenTelemetry setup\n registerEsmLoaderHooks: false,\n beforeBreadcrumb() { return null; }, // Disable breadcrumbs\n beforeSend(event, hint) {\n // some stuff that doesn't affect this in any way\n },\n });\n```\nNext, we initialize OpenTelemetry SDK using:\n```ts\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { AwsInstrumentation, type AwsSdkInstrumentationConfig } from '@opentelemetry/instrumentation-aws-sdk';\nimport { DnsInstrumentation, type DnsInstrumentationConfig } from '@opentelemetry/instrumentation-dns';\nimport { ExpressInstrumentation, type ExpressInstrumentationConfig } from '@opentelemetry/instrumentation-express';\nimport { FsInstrumentation, type FsInstrumentationConfig } from '@opentelemetry/instrumentation-fs';\nimport { HttpInstrumentation, type HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http';\nimport { IORedisInstrumentation, type IORedisInstrumentationConfig } from '@opentelemetry/instrumentation-ioredis';\nimport { MongoDBInstrumentation, type MongoDBInstrumentationConfig } from '@opentelemetry/instrumentation-mongodb';\nimport { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core';\nimport { NetInstrumentation } from '@opentelemetry/instrumentation-net';\nimport { envDetectorSync } from '@opentelemetry/resources';\nimport { NodeSDK } from '@opentelemetry/sdk-node';\n\nconst sdk = new NodeSDK({\n instrumentations: [\n new AwsInstrumentation({\n // This hides the underlying HTTP spans that aren't useful since we already have instrumentation for AWS SDK\n suppressInternalInstrumentation: true,\n ...config?.awsInstrumentationConfig,\n }),\n new DnsInstrumentation(config?.dnsInstrumentationConfig),\n new ExpressInstrumentation(config?.expressInstrumentationConfig),\n new FsInstrumentation(config?.fsInstrumentationConfig),\n new HttpInstrumentation({\n ignoreIncomingRequestHook(req) {\n // Do not include health check, icon, and metrics endpoints in traces.\n const isHealthCheckIconOrMetricsUrl = ['/health-check', '/favicon.ico', '/metrics'].includes(req.url || '');\n return isHealthCheckIconOrMetricsUrl;\n },\n ...config?.httpInstrumentationConfig,\n }),\n new IORedisInstrumentation(config?.ioRedisInstrumentationConfig),\n new MongoDBInstrumentation(config?.mongoDBInstrumentationConfig),\n new NestInstrumentation(config?.nestInstrumentationConfig),\n new NetInstrumentation(config?.netInstrumentationConfig),\n ],\n resourceDetectors: [envDetectorSync],\n});\n\nsdk.start();\n```\n\n### Steps to Reproduce\n\nIf you use the setup above, you'll have spans that look like following (coming from debug OpenTelemetry logs):\n```\nSpan {\n attributes: {\n 'http.url': 'http://localhost:3333/v2/users/me?token=secret',\n 'http.host': 'localhost:3333',\n 'net.host.name': 'localhost',\n 'http.method': 'GET',\n 'http.scheme': 'http',\n 'http.target': '/v2/users/me?token=secret',\n 'http.user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',\n 'http.flavor': '1.1',\n 'net.transport': 'ip_tcp',\n 'sentry.origin': 'auto.http.otel.http',\n 'net.host.ip': '::1',\n 'net.host.port': 3333,\n 'net.peer.ip': '::1',\n 'net.peer.port': 59381,\n 'http.status_code': 200,\n 'http.status_text': 'OK'\n },\n}\n```\nIf I turn Sentry instrumentation off, there'll also be `http.route`, which is coming from OpenTelemetry express instrumentation.\n\nIf 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)\n\n### Expected Result\n\nThe expected span would be something like the following (which I can get when I turn Sentry off):\n```\nSpan {\n attributes: {\n 'http.url': 'http://localhost:3333/v2/users/me?token=secret',\n 'http.host': 'localhost:3333',\n 'net.host.name': 'localhost',\n 'http.method': 'GET',\n 'http.scheme': 'http',\n 'http.target': '/v2/users/me?token=secret',\n 'http.user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',\n 'http.flavor': '1.1',\n 'net.transport': 'ip_tcp',\n 'net.host.ip': '::1',\n 'net.host.port': 3333,\n 'net.peer.ip': '::1',\n 'net.peer.port': 61320,\n 'http.status_code': 200,\n 'http.status_text': 'OK',\n 'http.route': '/v2/users/:username'\n },\n}\n```\n\nyou can notice the `http.route` at the end, that's what's missing.\n\n### Actual Result\n\n```\nSpan {\n attributes: {\n 'http.url': 'http://localhost:3333/v2/users/me?token=secret',\n 'http.host': 'localhost:3333',\n 'net.host.name': 'localhost',\n 'http.method': 'GET',\n 'http.scheme': 'http',\n 'http.target': '/v2/users/me?token=secret',\n 'http.user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',\n 'http.flavor': '1.1',\n 'net.transport': 'ip_tcp',\n 'sentry.origin': 'auto.http.otel.http',\n 'net.host.ip': '::1',\n 'net.host.port': 3333,\n 'net.peer.ip': '::1',\n 'net.peer.port': 59381,\n 'http.status_code': 200,\n 'http.status_text': 'OK'\n },\n}\n```","author":{"url":"https://github.com/jirimoravcik","@type":"Person","name":"jirimoravcik"},"datePublished":"2024-12-11T12:03:02Z","url":"https://github.com/getsentry/sentry-javascript/issues/14660"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:803b534c-0925-1f90-cd4b-907b94efd37e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E1E0:D410B:8F5E86:BBC43A:6B04CF5F |
| html-safe-nonce | cc1b5d02c112707b82a6da4cb633e782cbab2bc10466f6d24c392793994bff2d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUUwOkQ0MTBCOjhGNUU4NjpCQkM0M0E6NkIwNENGNUYiLCJ2aXNpdG9yX2lkIjoiNjkyNTA3ODUwMzkwNjEzNTkwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bdee2dfc4050bdf4b55b5772844656f1d632385e1503de1047a37f5f2d10f076 |
| hovercard-subject-tag | issue:2732791133 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/14660/issue_layout |
| twitter:image | https://opengraph.githubassets.com/526b50daeeb411ff8dac573015ae9f58646df249f45e1f0994b4b473264dca3e/getsentry/sentry-javascript/issues/14660 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/526b50daeeb411ff8dac573015ae9f58646df249f45e1f0994b4b473264dca3e/getsentry/sentry-javascript/issues/14660 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jirimoravcik |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27ed421e5c2dac040a37529b5b9191edcc4a3de70521471e81fb4b4d9dc2aa7d |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63dc19014c621c67306d7899c04c78dcd0d95803 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width