sentry-javascript
sentry-javascript copied to clipboard
feat(node): Use `@opentelemetry/instrumentation-undici` for fetch tracing
- Closes #12402
- Closes #12343
This PR migrates the nativeNodeFetchIntegration to use @opentelemetry/instrumentation-undici instead of opentelemetry-instrumentation-fetch-node.
This now gives us fetch instrumentation all the way back to Node v16.18. This PR also bumps the patch version of @opentelemetry/instrumentation-mongoose which was released at the same time.
There are a couple of outstanding issues:
-
For the
outgoing fetch > outgoing sampled fetch requests without active span are correctly instrumentedtests, thesentry-traceheader has an extra-1on the end. I have no idea what causes this! -
For
/api/v3portion of thefetch-unsampled/test.tsandfetch-sampled-no-active-span/test.ts, it fails because thebaggageheader is not undefined as expected. As far as I can tell,SentryPropagatorshould be excluding these from header injection but it's not. I guess this is because@opentelemetry/instrumentation-undiciis not setting theSEMATTRS_HTTP_URLattribute (http.url). Should the otel instrumentation be setting this or should we also be checking forSemanticAttributes.URL_FULLattribute (url.full) which it already sets? Here are the attributes it is already setting.
size-limit report 📦
| Path | Size | % Change | Change |
|---|---|---|---|
| @sentry/browser | 22.52 KB | - | - |
| @sentry/browser - with treeshaking flags | 21.3 KB | - | - |
| @sentry/browser (incl. Tracing) | 34.78 KB | - | - |
| @sentry/browser (incl. Tracing, Replay) | 71.23 KB | - | - |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 61.67 KB | - | - |
| @sentry/browser (incl. Tracing, Replay with Canvas) | 75.57 KB | - | - |
| @sentry/browser (incl. Tracing, Replay, Feedback) | 88.3 KB | - | - |
| @sentry/browser (incl. Tracing, Replay, Feedback, metrics) | 90.14 KB | - | - |
| @sentry/browser (incl. metrics) | 26.83 KB | - | - |
| @sentry/browser (incl. Feedback) | 39.6 KB | - | - |
| @sentry/browser (incl. sendFeedback) | 27.19 KB | - | - |
| @sentry/browser (incl. FeedbackAsync) | 31.9 KB | - | - |
| @sentry/react | 25.28 KB | - | - |
| @sentry/react (incl. Tracing) | 37.74 KB | - | - |
| @sentry/vue | 26.67 KB | - | - |
| @sentry/vue (incl. Tracing) | 36.61 KB | - | - |
| @sentry/svelte | 22.65 KB | - | - |
| CDN Bundle | 23.77 KB | - | - |
| CDN Bundle (incl. Tracing) | 36.49 KB | - | - |
| CDN Bundle (incl. Tracing, Replay) | 70.91 KB | - | - |
| CDN Bundle (incl. Tracing, Replay, Feedback) | 76.22 KB | - | - |
| CDN Bundle - uncompressed | 69.63 KB | - | - |
| CDN Bundle (incl. Tracing) - uncompressed | 108.21 KB | - | - |
| CDN Bundle (incl. Tracing, Replay) - uncompressed | 219.87 KB | - | - |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 233.07 KB | - | - |
| @sentry/nextjs (client) | 37.51 KB | - | - |
| @sentry/sveltekit (client) | 35.35 KB | - | - |
| @sentry/node | 126.36 KB | +1.11% | +1.38 KB 🔺 |
| @sentry/node - without tracing | 98.84 KB | +3.5% | +3.34 KB 🔺 |
| @sentry/aws-serverless | 109.1 KB | +1.47% | +1.58 KB 🔺 |
This suggests that http.url has been deprecated and will be replaced by url.full:
https://github.com/open-telemetry/semantic-conventions/blob/3c16c802e8ae8849ae0cf31eac02c3cabf64e4dd/model/registry/deprecated/http.yaml#L25-L30
One nextjs-14 e2e test did need a change due to the differing attributes