Skip to content

Commit cbf22b6

Browse files
committed
this is gonna be a pain to test
1 parent ea43514 commit cbf22b6

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

packages/node/src/integrations/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export { ContextLines } from './contextlines';
88
export { Context } from './context';
99
export { RequestData } from './requestdata';
1010
export { LocalVariables } from './localvariables';
11+
export { Undici } from './undici';

packages/node/src/integrations/undici.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class Undici implements Integration {
6363

6464
private readonly _options: UndiciOptions;
6565

66-
public constructor(_options: UndiciOptions) {
66+
public constructor(_options: Partial<UndiciOptions> = {}) {
6767
this._options = {
6868
...DEFAULT_UNDICI_OPTIONS,
6969
..._options,
@@ -114,13 +114,19 @@ export class Undici implements Integration {
114114
: true;
115115

116116
if (shouldCreateSpan) {
117+
const data: Record<string, unknown> = {};
118+
const params = url.searchParams.toString();
119+
if (params) {
120+
data['http.query'] = `?${params}`;
121+
}
122+
if (url.hash) {
123+
data['http.fragment'] = url.hash;
124+
}
125+
117126
const span = activeSpan.startChild({
118127
op: 'http.client',
119128
description: `${request.method || 'GET'} ${stripUrlQueryAndFragment(stringUrl)}`,
120-
data: {
121-
'http.query': `?${url.searchParams.toString()}`,
122-
'http.fragment': url.hash,
123-
},
129+
data,
124130
});
125131
request.__sentry__ = span;
126132

0 commit comments

Comments
 (0)