Skip to content

Commit 6d0557f

Browse files
committed
seer feedback
1 parent 9f6ae21 commit 6d0557f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/node/src/integrations/http.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { diag } from '@opentelemetry/api';
33
import type { HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http';
44
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
55
import type { Span } from '@sentry/core';
6-
import { defineIntegration, getClient, hasSpansEnabled } from '@sentry/core';
6+
import { defineIntegration, getClient, hasSpansEnabled, stripUrlQueryAndFragment } from '@sentry/core';
77
import type { HTTPModuleRequestIncomingMessage, NodeClient } from '@sentry/node-core';
88
import {
99
type SentryHttpInstrumentationOptions,
@@ -336,17 +336,14 @@ function getConfigWithDefaults(options: Partial<HttpOptions> = {}): HttpInstrume
336336
* Only exported for tests.
337337
*/
338338
export function isStaticAssetRequest(urlPath: string): boolean {
339-
if (urlPath === '/favicon.ico' || urlPath.startsWith('/favicon')) {
340-
return true;
341-
}
342-
339+
const path = stripUrlQueryAndFragment(urlPath);
343340
// Common static file extensions
344-
if (urlPath.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
341+
if (path.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
345342
return true;
346343
}
347344

348345
// Common metadata files
349-
if (urlPath.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
346+
if (path.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
350347
return true;
351348
}
352349

packages/node/test/integrations/http.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('httpIntegration', () => {
3838
['/images/logo.svg', true],
3939
['/img/photo.jpeg', true],
4040
['/img/photo.jpg', true],
41+
['/img/photo.jpg?v=123', true],
4142
['/img/photo.webp', true],
4243
['/font/font.ttf', true],
4344
['/robots.txt', true],

0 commit comments

Comments
 (0)