@@ -18,6 +18,7 @@ export { onUncaughtExceptionIntegration } from './onUncaughtExceptionIntegration
18
18
19
19
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
20
20
__rewriteFramesDistDir__ ?: string ;
21
+ __sentryRewritesTunnelPath__ ?: string ;
21
22
} ;
22
23
23
24
/**
@@ -73,7 +74,9 @@ export function init(options: NodeOptions): void {
73
74
}
74
75
75
76
const customDefaultIntegrations = [
76
- ...getDefaultIntegrations ( options ) . filter ( integration => integration . name !== 'OnUncaughtException' ) ,
77
+ ...getDefaultIntegrations ( options ) . filter (
78
+ integration => integration . name !== 'OnUncaughtException' && integration . name !== 'NodeFetch' ,
79
+ ) ,
77
80
onUncaughtExceptionIntegration ( ) ,
78
81
] ;
79
82
@@ -107,19 +110,49 @@ export function init(options: NodeOptions): void {
107
110
108
111
nodeInit ( opts ) ;
109
112
110
- const filterTransactions : EventProcessor = event => {
111
- return event . type === 'transaction' && event . transaction === '/404' ? null : event ;
113
+ const filterLowQualityTransactions : EventProcessor = event => {
114
+ if ( event . type === 'transaction' ) {
115
+ if ( event . transaction ?. match ( / G E T \/ .* \/ s t a t i c \/ .* .j s / ) ) {
116
+ // TODO: Make this based on basePath and assetPrefix
117
+ return null ;
118
+ } else if (
119
+ globalWithInjectedValues . __sentryRewritesTunnelPath__ &&
120
+ event . transaction === `POST ${ globalWithInjectedValues . __sentryRewritesTunnelPath__ } `
121
+ ) {
122
+ return null ;
123
+ } else if ( event . transaction ?. match ( / \/ _ _ n e x t j s _ o r i g i n a l - s t a c k - f r a m e / ) ) {
124
+ return null ;
125
+ } else if ( event . transaction === '/404' ) {
126
+ return null ;
127
+ }
128
+
129
+ return event ;
130
+ } else {
131
+ return event ;
132
+ }
112
133
} ;
113
-
114
- filterTransactions . id = 'NextServer404TransactionFilter' ;
134
+ filterLowQualityTransactions . id = 'NextLowQualityTransactionsFilter' ;
135
+ addEventProcessor ( filterLowQualityTransactions ) ;
136
+
137
+ const filterSentrySpans : EventProcessor = event => {
138
+ if ( event . type === 'transaction' ) {
139
+ event . spans = event . spans ?. filter (
140
+ span =>
141
+ ! span . data ?. [ 'http.target' ] ?. includes ( 'sentry_client' ) && ! span . data ?. [ 'http.target' ] ?. includes ( 'sentry_key' ) ,
142
+ ) ;
143
+ event . spans = event . spans ?. filter ( span => ! span . data ?. [ 'http.url' ] ?. includes ( '__nextjs_original-stack-frame' ) ) ;
144
+ }
145
+
146
+ return event ;
147
+ } ;
148
+ filterSentrySpans . id = 'NextFilterSentrySpans' ;
149
+ addEventProcessor ( filterSentrySpans ) ;
115
150
116
151
setTag ( 'runtime' , 'node' ) ;
117
152
if ( IS_VERCEL ) {
118
153
setTag ( 'vercel' , true ) ;
119
154
}
120
155
121
- addEventProcessor ( filterTransactions ) ;
122
-
123
156
if ( process . env . NODE_ENV === 'development' ) {
124
157
addEventProcessor ( devErrorSymbolicationEventProcessor ) ;
125
158
}
0 commit comments