-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(node): Use @opentelemetry/instrumentation-undici
for fetch tracing
#13485
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
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
@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.