Skip to content

Commit 4b4059e

Browse files
committed
adjust to trace origin scheme
1 parent c202207 commit 4b4059e

11 files changed

+16
-14
lines changed

packages/nextjs/src/common/captureRequestError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC
3838
captureException(error, {
3939
mechanism: {
4040
handled: false,
41-
type: 'nextjs.onRequestError',
41+
type: 'auto.function.nextjs.onRequestError',
4242
},
4343
});
4444

packages/nextjs/src/common/pages-router-instrumentation/_error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function captureUnderscoreErrorException(contextOrProps: ContextOrP
4545
// is what passing a string to `captureException` will wind up doing)
4646
captureException(err || `_error.js called with falsy error (${err})`, {
4747
mechanism: {
48-
type: 'nextjs._error',
48+
type: 'auto.function.nextjs.underscoreError',
4949
handled: false,
5050
data: {
5151
function: '_error.getInitialProps',

packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz
110110

111111
captureException(objectifiedErr, {
112112
mechanism: {
113-
type: 'nextjs.api',
113+
type: 'auto.http.nextjs.apiHandler',
114114
handled: false,
115115
data: {
116116
wrapped_handler: wrappingTarget.name,

packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C
4848
captureException(e, {
4949
mechanism: {
5050
handled: false,
51-
type: 'nextjs.page.class',
51+
type: 'auto.function.nextjs.pageClass',
5252
},
5353
});
5454
throw e;
@@ -78,7 +78,7 @@ export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | C
7878
captureException(e, {
7979
mechanism: {
8080
handled: false,
81-
type: 'nextjs.page.function',
81+
type: 'auto.function.nextjs.pageFunction',
8282
},
8383
});
8484
throw e;

packages/nextjs/src/common/utils/wrapperUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function withErrorInstrumentation<F extends (...args: any[]) => any>(
2828
captureException(e, {
2929
// TODO: check if origFunction.name actually returns the correct name or minified garbage
3030
// in this case, we can add another argument to this wrapper with the respective function name
31-
mechanism: { handled: false, type: 'nextjs.wrapped', data: { function: origFunction.name } },
31+
mechanism: { handled: false, type: 'auto.function.nextjs.wrapped', data: { function: origFunction.name } },
3232
});
3333
throw e;
3434
}
@@ -103,7 +103,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis
103103
try {
104104
return await origFunction(...origFunctionArgs);
105105
} catch (e) {
106-
captureException(e, { mechanism: { handled: false, type: 'nextjs' } });
106+
captureException(e, { mechanism: { handled: false, type: 'auto.function.nextjs.dataFetcher' } });
107107
throw e;
108108
}
109109
}

packages/nextjs/src/common/withServerActionInstrumentation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
getClient,
88
getIsolationScope,
99
handleCallbackErrors,
10+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
1011
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
1112
SPAN_STATUS_ERROR,
1213
startSpan,
@@ -116,6 +117,7 @@ async function withServerActionInstrumentationImplementation<A extends (...args:
116117
forceTransaction: true,
117118
attributes: {
118119
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
120+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.serverAction',
119121
},
120122
},
121123
async span => {
@@ -130,7 +132,7 @@ async function withServerActionInstrumentationImplementation<A extends (...args:
130132
captureException(error, {
131133
mechanism: {
132134
handled: false,
133-
type: 'nextjs.server-action',
135+
type: 'auto.function.nextjs.serverAction',
134136
},
135137
});
136138
}

packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function wrapGenerationFunctionWithSentry<F extends (...args: any[]) => a
138138
captureException(err, {
139139
mechanism: {
140140
handled: false,
141-
type: 'nextjs.generation-function',
141+
type: 'auto.function.nextjs.generationFunction',
142142
data: {
143143
function: generationFunctionIdentifier,
144144
},

packages/nextjs/src/common/wrapMiddlewareWithSentry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function wrapMiddlewareWithSentry<H extends EdgeRouteHandler>(
102102
error => {
103103
captureException(error, {
104104
mechanism: {
105-
type: 'nextjs.middleware',
105+
type: 'auto.function.nextjs.wrapMiddlewareWithSentry',
106106
handled: false,
107107
},
108108
});

packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function wrapRouteHandlerWithSentry<F extends (...args: any[]) => any>(
9090
captureException(error, {
9191
mechanism: {
9292
handled: false,
93-
type: 'nextjs.route-handler',
93+
type: 'auto.function.nextjs.routeHandler',
9494
},
9595
});
9696
}

packages/nextjs/src/common/wrapServerComponentWithSentry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
108108
name: `${componentType} Server Component (${componentRoute})`,
109109
attributes: {
110110
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
111-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs',
111+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.serverComponent',
112112
'sentry.nextjs.ssr.function.type': componentType,
113113
'sentry.nextjs.ssr.function.route': componentRoute,
114114
},
@@ -130,7 +130,7 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
130130
captureException(error, {
131131
mechanism: {
132132
handled: false,
133-
type: 'nextjs.server-component',
133+
type: 'auto.function.nextjs.serverComponent',
134134
},
135135
});
136136
}

0 commit comments

Comments
 (0)