-
-
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
Changes from 2 commits
dbd4ed8
eb0a361
15b856c
f94e183
7342e61
5d2d0f2
4fa38f3
4368628
6b3adb3
2e621b2
0db9814
df01350
cc873d8
033a154
7545513
88728a1
0cb3322
4a73857
e8e2198
8bb6c75
049d328
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ import { | |
| SEMANTIC_ATTRIBUTE_SENTRY_OP, | ||
| SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, | ||
| SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, | ||
| SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, | ||
| SEMANTIC_ATTRIBUTE_URL_FULL, | ||
| captureException, | ||
| continueTrace, | ||
| flush, | ||
|
|
@@ -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, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| [SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: request.method, | ||
| [SEMANTIC_ATTRIBUTE_URL_FULL]: request.url, | ||
| }; | ||
|
|
||
| const contentLength = request.headers.get('content-length'); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,9 +39,9 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => { | |
| name: 'NodeFetch', | ||
| setupOnce() { | ||
| const instrumentation = new UndiciInstrumentation({ | ||
| requireParentforSpans: false, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, thought the same but this is incorrect/different upstream! |
||
| ignoreRequestHook: request => { | ||
| const url = getAbsoluteUrl(request.origin, request.path); | ||
| const tracingDisabled = !hasTracingEnabled(); | ||
| const shouldIgnore = _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url); | ||
|
|
||
| if (shouldIgnore) { | ||
|
|
@@ -50,7 +50,7 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => { | |
|
|
||
| // If tracing is disabled, we still want to propagate traces | ||
| // So we do that manually here, matching what the instrumentation does otherwise | ||
| if (tracingDisabled) { | ||
| if (!hasTracingEnabled()) { | ||
timfish marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const ctx = context.active(); | ||
| const addedHeaders: Record<string, string> = {}; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.