-
-
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
feat(node): Use @opentelemetry/instrumentation-undici
for fetch tracing
#13485
Conversation
size-limit report 📦
|
This suggests that |
…on doesn't set it
@@ -45,8 +47,8 @@ export function wrapRequestHandler( | |||
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.cloudflare', | |||
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', | |||
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', | |||
['http.request.method']: request.method, | |||
['url.full']: request.url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced these in a couple of places since I just added temporary constants for them
...packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts
Outdated
Show resolved
Hide resolved
name: 'NodeFetch', | ||
setupOnce() { | ||
const instrumentation = new UndiciInstrumentation({ | ||
requireParentforSpans: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a typo in our config or upstream, seems like it should be requireParentForSpans
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, thought the same but this is incorrect/different upstream!
https://github.com/open-telemetry/opentelemetry-js-contrib/blob/b09cb40242f09c0a52bacd15a7d8c84e954d57e0/plugins/node/instrumentation-undici/src/types.ts#L81
One nextjs-14 e2e test did need a change due to the differing attributes |
…13587) This bumps all our internal OTEL instrumentation to their latest version. Mainly, this fixes two things: * Mongoose now supports v7 & v8 open-telemetry/opentelemetry-js-contrib#2353 * A variety of bug fixes, including a problem with http.get in ESM mode open-telemetry/opentelemetry-js#4857 - See: https://github.com/open-telemetry/opentelemetry-js/releases/tag/experimental%2Fv0.53.0 Related: * open-telemetry/opentelemetry-js#4975 Issue about relaxing deps in "core" instrumentation packages * PR to bump deps in `@prisma/instrumentation`: prisma/prisma#25160 * PR to bump deps in `opentelemetry-instrument-remix`: justindsmith/opentelemetry-instrumentations-js#52 * PR to bump deps in `opentelemetry-instrumentation-fetch-node`: gas-buddy/opentelemetry-instrumentation-fetch-node#17 (which will also be superseded by #13485 eventually) * Closes #11499
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@sentry/node](https://github.com/getsentry/sentry-javascript/tree/master/packages/node) ([source](https://github.com/getsentry/sentry-javascript)) | dependencies | minor | [`8.26.0` -> `8.30.0`](https://renovatebot.com/diffs/npm/@sentry%2fnode/8.26.0/8.30.0) | | [@sentry/react](https://github.com/getsentry/sentry-javascript/tree/master/packages/react) ([source](https://github.com/getsentry/sentry-javascript)) | dependencies | minor | [`8.26.0` -> `8.30.0`](https://renovatebot.com/diffs/npm/@sentry%2freact/8.26.0/8.30.0) | --- ### Release Notes <details> <summary>getsentry/sentry-javascript (@​sentry/node)</summary> ### [`v8.30.0`](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#8300) [Compare Source](getsentry/sentry-javascript@8.29.0...8.30.0) ##### Important Changes - *feat(node): Add `kafkajs` integration ([#​13528](getsentry/sentry-javascript#13528 This release adds a new integration that instruments `kafkajs` library with spans and traces. This integration is automatically enabled by default, but can be included with the `Sentry.kafkaIntegration()` import. ```js Sentry.init({ integrations: [Sentry.kafkaIntegration()], }); ``` ##### Other Changes - feat(core): Allow adding measurements without global client ([#​13612](getsentry/sentry-javascript#13612)) - feat(deps): Bump [@​opentelemetry/instrumentation-undici](https://github.com/opentelemetry/instrumentation-undici) from 0.5.0 to 0.6.0 ([#​13622](getsentry/sentry-javascript#13622)) - feat(deps): Bump [@​sentry/cli](https://github.com/sentry/cli) from 2.33.0 to 2.35.0 ([#​13624](getsentry/sentry-javascript#13624)) - feat(node): Use `@opentelemetry/instrumentation-undici` for fetch tracing ([#​13485](getsentry/sentry-javascript#13485)) - feat(nuxt): Add server config to root folder ([#​13583](getsentry/sentry-javascript#13583)) - feat(otel): Upgrade [@​opentelemetry/semantic-conventions](https://github.com/opentelemetry/semantic-conventions) to 1.26.0 ([#​13631](getsentry/sentry-javascript#13631)) - fix(browser): check supportedEntryTypes before caling the function ([#​13541](getsentry/sentry-javascript#13541)) - fix(browser): Ensure Standalone CLS span timestamps are correct ([#​13649](getsentry/sentry-javascript#13649)) - fix(nextjs): Widen removal of 404 transactions ([#​13628](getsentry/sentry-javascript#13628)) - fix(node): Remove ambiguity and race conditions when matching local variables to exceptions ([#​13501](getsentry/sentry-javascript#13501)) - fix(node): Update OpenTelemetry instrumentation package for solidstart and opentelemetry ([#​13640](getsentry/sentry-javascript#13640)) - fix(node): Update OpenTelemetry instrumentation package for solidstart and opentelemetry ([#​13642](getsentry/sentry-javascript#13642)) - fix(vue): Ensure Vue `trackComponents` list matches components with or without `<>` ([#​13543](getsentry/sentry-javascript#13543)) - ref(profiling): Conditionally shim cjs globals ([#​13267](getsentry/sentry-javascript#13267)) Work in this release was contributed by [@​Zen-cronic](https://github.com/Zen-cronic) and [@​odanado](https://github.com/odanado). Thank you for your contributions! ### [`v8.29.0`](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#8290) [Compare Source](getsentry/sentry-javascript@8.28.0...8.29.0) ##### Important Changes - **Beta releases of official Solid and SolidStart Sentry SDKs** This release marks the beta releases of the `@sentry/solid` and `@sentry/solidstart` Sentry SDKs. For details on how to use them, check out the [Sentry Solid SDK README](https://github.com/getsentry/sentry-javascript/tree/develop/packages/solid) and the [Sentry SolidStart SDK README](https://github.com/getsentry/sentry-javascript/tree/develop/packages/solidstart) respectively. Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns. - **feat(node): Option to only wrap instrumented modules ([#​13139](getsentry/sentry-javascript#13139 Adds the SDK option to only wrap ES modules with `import-in-the-middle` that specifically need to be instrumented. ```javascript import * as Sentry from '@​sentry/node'; Sentry.init({ dsn: '__PUBLIC_DSN__', registerEsmLoaderHooks: { onlyIncludeInstrumentedModules: true }, }); ``` - **feat(node): Update OpenTelemetry packages to instrumentation v0.53.0 ([#​13587](getsentry/sentry-javascript#13587 All internal OpenTelemetry instrumentation was updated to their latest version. This adds support for Mongoose v7 and v8 and fixes various bugs related to ESM mode. ##### Other Changes - feat(nextjs): Emit warning when using turbopack ([#​13566](getsentry/sentry-javascript#13566)) - feat(nextjs): Future-proof Next.js config options overriding ([#​13586](getsentry/sentry-javascript#13586)) - feat(node): Add `generic-pool` integration ([#​13465](getsentry/sentry-javascript#13465)) - feat(nuxt): Upload sourcemaps generated by Nitro ([#​13382](getsentry/sentry-javascript#13382)) - feat(solidstart): Add `browserTracingIntegration` by default ([#​13561](getsentry/sentry-javascript#13561)) - feat(solidstart): Add `sentrySolidStartVite` plugin to simplify source maps upload ([#​13493](getsentry/sentry-javascript#13493)) - feat(vue): Only start UI spans if parent is available ([#​13568](getsentry/sentry-javascript#13568)) - fix(cloudflare): Guard `context.waitUntil` call in request handler ([#​13549](getsentry/sentry-javascript#13549)) - fix(gatsby): Fix assets path for sourcemaps upload ([#​13592](getsentry/sentry-javascript#13592)) - fix(nextjs): Use posix paths for sourcemap uploads ([#​13603](getsentry/sentry-javascript#13603)) - fix(node-fetch): Use stringified origin url ([#​13581](getsentry/sentry-javascript#13581)) - fix(node): Replace dashes in `generic-pool` span origins with underscores ([#​13579](getsentry/sentry-javascript#13579)) - fix(replay): Fix types in WebVitalData ([#​13573](getsentry/sentry-javascript#13573)) - fix(replay): Improve replay web vital types ([#​13602](getsentry/sentry-javascript#13602)) - fix(utils): Keep logger on carrier ([#​13570](getsentry/sentry-javascript#13570)) Work in this release was contributed by [@​Zen-cronic](https://github.com/Zen-cronic). Thank you for your contribution! ### [`v8.28.0`](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#8280) [Compare Source](getsentry/sentry-javascript@8.27.0...8.28.0) ##### Important Changes - **Beta release of official NestJS SDK** This release contains the beta version of `@sentry/nestjs`! For details on how to use it, check out the [README](https://github.com/getsentry/sentry-javascript/blob/master/packages/nestjs/README.md). Any feedback/bug reports are greatly appreciated, please reach out on GitHub. - **fix(browser): Remove faulty LCP, FCP and FP normalization logic ([#​13502](getsentry/sentry-javascript#13502 This release fixes a bug in the `@sentry/browser` package and all SDKs depending on this package (e.g. `@sentry/react` or `@sentry/nextjs`) that caused the SDK to send incorrect web vital values for the LCP, FCP and FP vitals. The SDK previously incorrectly processed the original values as they were reported from the browser. When updating your SDK to this version, you might experience an increase in LCP, FCP and FP values, which potentially leads to a decrease in your performance score in the Web Vitals Insights module in Sentry. This is because the previously reported values were smaller than the actually measured values. We apologize for the inconvenience! ##### Other Changes - feat(nestjs): Add `SentryGlobalGraphQLFilter` ([#​13545](getsentry/sentry-javascript#13545)) - feat(nestjs): Automatic instrumentation of nestjs interceptors after route execution ([#​13264](getsentry/sentry-javascript#13264)) - feat(nextjs): Add `bundleSizeOptimizations` to build options ([#​13323](getsentry/sentry-javascript#13323)) - feat(nextjs): Stabilize `captureRequestError` ([#​13550](getsentry/sentry-javascript#13550)) - feat(nuxt): Wrap config in nuxt context ([#​13457](getsentry/sentry-javascript#13457)) - feat(profiling): Expose profiler as top level primitive ([#​13512](getsentry/sentry-javascript#13512)) - feat(replay): Add layout shift to CLS replay data ([#​13386](getsentry/sentry-javascript#13386)) - feat(replay): Upgrade rrweb packages to 2.26.0 ([#​13483](getsentry/sentry-javascript#13483)) - fix(cdn): Do not mangle \_metadata ([#​13426](getsentry/sentry-javascript#13426)) - fix(cdn): Fix SDK source for CDN bundles ([#​13475](getsentry/sentry-javascript#13475)) - fix(nestjs): Check arguments before instrumenting with `@Injectable` ([#​13544](getsentry/sentry-javascript#13544)) - fix(nestjs): Ensure exception and host are correctly passed on when using [@​WithSentry](https://github.com/WithSentry) ([#​13564](getsentry/sentry-javascript#13564)) - fix(node): Suppress tracing for transport request execution rather than transport creation ([#​13491](getsentry/sentry-javascript#13491)) - fix(replay): Consider more things as DOM mutations for dead clicks ([#​13518](getsentry/sentry-javascript#13518)) - fix(vue): Correctly obtain component name ([#​13484](getsentry/sentry-javascript#13484)) Work in this release was contributed by [@​leopoldkristjansson](https://github.com/leopoldkristjansson), [@​mhuggins](https://github.com/mhuggins) and [@​filips123](https://github.com/filips123). Thank you for your contributions! ### [`v8.27.0`](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#8270) [Compare Source](getsentry/sentry-javascript@8.26.0...8.27.0) ##### Important Changes - **fix(nestjs): Exception filters in main app module are not being executed ([#​13278](getsentry/sentry-javascript#13278 With this release nestjs error monitoring is no longer automatically set up after adding the `SentryModule` to your application, which led to issues in certain scenarios. You will now have to either add the `SentryGlobalFilter` to your main module providers or decorate the `catch()` method in your existing global exception filters with the newly released `@WithSentry()` decorator. See the [docs](https://docs.sentry.io/platforms/javascript/guides/nestjs/) for more details. ##### Other Changes - feat: Add options for passing nonces to feedback integration ([#​13347](getsentry/sentry-javascript#13347)) - feat: Add support for SENTRY_SPOTLIGHT env var in Node ([#​13325](getsentry/sentry-javascript#13325)) - feat(deps): bump [@​prisma/instrumentation](https://github.com/prisma/instrumentation) from 5.17.0 to 5.18.0 ([#​13327](getsentry/sentry-javascript#13327)) - feat(feedback): Improve error message for 403 errors ([#​13441](getsentry/sentry-javascript#13441)) - fix(deno): Don't rely on `Deno.permissions.querySync` ([#​13378](getsentry/sentry-javascript#13378)) - fix(replay): Ensure we publish replay CDN bundles ([#​13437](getsentry/sentry-javascript#13437)) Work in this release was contributed by [@​charpeni](https://github.com/charpeni). Thank you for your contribution! </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41NS4zIiwidXBkYXRlZEluVmVyIjoiMzguNzMuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19--> Reviewed-on: https://git.tristess.app/alexandresoro/ouca/pulls/61 Reviewed-by: Alexandre Soro <[email protected]> Co-authored-by: renovate <[email protected]> Co-committed-by: renovate <[email protected]>
@opentelemetry/instrumentation-undici
#12402This PR migrates the
nativeNodeFetchIntegration
to use@opentelemetry/instrumentation-undici
instead ofopentelemetry-instrumentation-fetch-node
.The instrumentation is still exported as
nativeNodeFetchIntegration
and is namedNodeFetch
to ensure backwards compatibility and the tests passwithout changes.Note: One
nextjs-14
e2e test did need a change due to the new/differing attribute names.It's worth noting that
@opentelemetry/instrumentation-undici
uses different attributes from the latest semantic convention version vs what we are using and what's used byopentelemetry-instrumentation-fetch-node
. It looks like the http instrumentation is migrating to these too so some of the changes in this PR will ensure that the http instrumentation continues to work after these updates.Outstanding issues:
For theoutgoing fetch > outgoing sampled fetch requests without active span are correctly instrumented
tests, thesentry-trace
header has an extra-1
on the end. I have no idea what causes this!For/api/v3
portion of thefetch-unsampled/test.ts
andfetch-sampled-no-active-span/test.ts
, it fails because thebaggage
header is not undefined as expected. As far as I can tell,SentryPropagator
should be excluding these from header injection but it's not. I guess this is because@opentelemetry/instrumentation-undici
is not setting theSEMATTRS_HTTP_URL
attribute (http.url
). Should the otel instrumentation be setting this or should we also be checking forSemanticAttributes.URL_FULL
attribute (url.full
) which it already sets? Here are the attributes it is already setting.