File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
packages/react-router/src/server/instrumentation Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
1212} from '@sentry/core' ;
1313import type * as reactRouter from 'react-router' ;
1414import { DEBUG_BUILD } from '../../common/debug-build' ;
15- import { getSpanName , isDataRequest } from './util' ;
15+ import { getOpName , getSpanName , isDataRequest } from './util' ;
1616
1717type ReactRouterModuleExports = typeof reactRouter ;
1818
@@ -87,7 +87,7 @@ export class ReactRouterInstrumentation extends InstrumentationBase<Instrumentat
8787 attributes : {
8888 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'url' ,
8989 [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'auto.http.react-router' ,
90- [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : 'function.react-router.loader' ,
90+ [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : getOpName ( url . pathname , request . method ) ,
9191 url : url . pathname ,
9292 method : request . method ,
9393 } ,
Original file line number Diff line number Diff line change 1+ /**
2+ * Gets the op name for a request based on whether it's a loader or action request.
3+ * @param pathName The URL pathname to check
4+ * @param requestMethod The HTTP request method
5+ */
6+ export function getOpName ( pathName : string , requestMethod : string ) : string {
7+ return isLoaderRequest ( pathName , requestMethod )
8+ ? 'function.react-router.loader'
9+ : isActionRequest ( pathName , requestMethod )
10+ ? 'function.react-router.action'
11+ : 'function.react-router' ;
12+ }
13+
114/**
215 * Gets the span name for a request based on whether it's a loader or action request.
316 * @param pathName The URL pathname to check
You can’t perform that action at this time.
0 commit comments