Skip to content

Commit d945791

Browse files
committed
fix: exclude cache events from low quality filter
1 parent 4e5a8fe commit d945791

File tree

1 file changed

+9
-2
lines changed
  • packages/nuxt/src/server

1 file changed

+9
-2
lines changed

packages/nuxt/src/server/sdk.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'node:path';
2-
import type { Client, EventProcessor, Integration } from '@sentry/core';
2+
import type { Client, Event, EventProcessor, Integration } from '@sentry/core';
33
import { applySdkMetadata, debug, flush, getGlobalScope, vercelWaitUntil } from '@sentry/core';
44
import {
55
type NodeOptions,
@@ -40,7 +40,7 @@ export function init(options: SentryNuxtServerOptions): Client | undefined {
4040
export function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {
4141
return Object.assign(
4242
(event => {
43-
if (event.type !== 'transaction' || !event.transaction) {
43+
if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {
4444
return event;
4545
}
4646

@@ -111,3 +111,10 @@ async function flushSafelyWithTimeout(): Promise<void> {
111111
DEBUG_BUILD && debug.log('Error while flushing events:\n', e);
112112
}
113113
}
114+
115+
/**
116+
* Checks if the event is a cache event.
117+
*/
118+
function isCacheEvent(e: Event): boolean {
119+
return e.contexts?.trace?.origin === 'auto.cache.nuxt';
120+
}

0 commit comments

Comments
 (0)