Skip to content

Commit 4e2d017

Browse files
committed
fix(node): Add request to hint for native node fetch breadcrumb
1 parent 10fbee2 commit 4e2d017

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

packages/node/src/integrations/node-fetch.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {
4444
const url = request.origin;
4545
return _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url);
4646
},
47-
onRequest: ({ span }: { span: Span }) => {
47+
onRequest: ({ span, request }: { span: Span; request: unknown }) => {
4848
_updateSpan(span);
4949

5050
if (_breadcrumbs) {
51-
_addRequestBreadcrumb(span);
51+
_addRequestBreadcrumb(span, request);
5252
}
5353
},
5454
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -80,17 +80,23 @@ function _updateSpan(span: Span): void {
8080
}
8181

8282
/** Add a breadcrumb for outgoing requests. */
83-
function _addRequestBreadcrumb(span: Span): void {
83+
function _addRequestBreadcrumb(span: Span, request: unknown): void {
8484
if (getSpanKind(span) !== SpanKind.CLIENT) {
8585
return;
8686
}
8787

8888
const data = getRequestSpanData(span);
89-
addBreadcrumb({
90-
category: 'http',
91-
data: {
92-
...data,
89+
addBreadcrumb(
90+
{
91+
category: 'http',
92+
data: {
93+
...data,
94+
},
95+
type: 'http',
9396
},
94-
type: 'http',
95-
});
97+
{
98+
event: 'response',
99+
request,
100+
},
101+
);
96102
}

0 commit comments

Comments
 (0)