Skip to content

Commit 2f90c3c

Browse files
committed
fix remix
1 parent 0b0142f commit 2f90c3c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/node-core/src/integrations/http/SentryHttpInstrumentation.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ export type SentryHttpInstrumentationOptions = InstrumentationConfig & {
6565
*/
6666
ignoreStaticAssets?: boolean;
6767

68+
/**
69+
* If true, do not generate spans for incoming requests at all.
70+
* This is used by Remix to avoid generating spans for incoming requests, as it generates its own spans.
71+
*/
72+
disableIncomingRequestSpans?: boolean;
73+
6874
/**
6975
* Do not capture breadcrumbs for outgoing HTTP requests to URLs where the given callback returns `true`.
7076
* For the scope of this instrumentation, this callback only controls breadcrumb creation.
@@ -174,6 +180,8 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
174180
// but we only want to register them once, whichever is loaded first
175181
let hasRegisteredHandlers = false;
176182

183+
const spansEnabled = this.getConfig().spans ?? true;
184+
177185
const onHttpServerRequestStart = ((_data: unknown) => {
178186
const data = _data as { server: http.Server };
179187
instrumentServer(data.server, {
@@ -186,7 +194,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
186194
trackIncomingRequestsAsSessions: this.getConfig().trackIncomingRequestsAsSessions,
187195
sessionFlushingDelayMS: this.getConfig().sessionFlushingDelayMS ?? 60_000,
188196
ignoreStaticAssets: this.getConfig().ignoreStaticAssets,
189-
spans: this.getConfig().spans ?? true,
197+
spans: spansEnabled && !this.getConfig().disableIncomingRequestSpans,
190198
});
191199
}) satisfies ChannelListener;
192200

0 commit comments

Comments
 (0)