Skip to content

Commit 9348717

Browse files
committed
change variable name s/url/urlPath, update JSDoc
1 parent 7cbfd34 commit 9348717

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

dev-packages/node-integration-tests/suites/tracing/httpIntegration/server-ignoreIncomingRequests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Sentry.init({
1010
integrations: [
1111
Sentry.httpIntegration({
1212
ignoreIncomingRequests: url => {
13+
console.log('url', url);
1314
return url.includes('/liveness');
1415
},
1516
}),

packages/node/src/integrations/http.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ interface HttpOptions {
3434
/**
3535
* Do not capture spans or breadcrumbs for outgoing HTTP requests to URLs where the given callback returns `true`.
3636
* This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.
37+
*
38+
* The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.
39+
* For example: `'https://someService.com/users/details?id=123'`
3740
*/
3841
ignoreOutgoingRequests?: (url: string) => boolean;
3942

4043
/**
4144
* Do not capture spans or breadcrumbs for incoming HTTP requests to URLs where the given callback returns `true`.
4245
* This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.
46+
*
47+
* The `url` param consists of the URL path and query string (if any) of the incoming request.
48+
* For example: `'/users/details?id=123'`
4349
*/
44-
ignoreIncomingRequests?: (url: string) => boolean;
50+
ignoreIncomingRequests?: (urlPath: string) => boolean;
4551

4652
/**
4753
* Additional instrumentation options that are passed to the underlying HttpInstrumentation.
@@ -103,7 +109,9 @@ export const instrumentHttp = Object.assign(
103109
},
104110

105111
ignoreIncomingRequestHook: request => {
106-
const url = request.url;
112+
// request.url is the only property that holds any information about the url
113+
// it only consists of the URL path and query string (if any)
114+
const urlPath = request.url;
107115

108116
const method = request.method?.toUpperCase();
109117
// We do not capture OPTIONS/HEAD requests as transactions
@@ -112,7 +120,7 @@ export const instrumentHttp = Object.assign(
112120
}
113121

114122
const _ignoreIncomingRequests = _httpOptions.ignoreIncomingRequests;
115-
if (url && _ignoreIncomingRequests && _ignoreIncomingRequests(url)) {
123+
if (urlPath && _ignoreIncomingRequests && _ignoreIncomingRequests(urlPath)) {
116124
return true;
117125
}
118126

0 commit comments

Comments
 (0)