File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11import { context } from '@opentelemetry/api' ;
22import {
3+ SEMANTIC_ATTRIBUTE_SENTRY_OP ,
34 applySdkMetadata ,
45 getCapturedScopesOnSpan ,
56 getCurrentScope ,
67 getIsolationScope ,
78 getRootSpan ,
89 registerSpanErrorInstrumentation ,
910 setCapturedScopesOnSpan ,
11+ spanToJSON ,
1012} from '@sentry/core' ;
1113
1214import { GLOBAL_OBJ } from '@sentry/utils' ;
@@ -52,8 +54,15 @@ export function init(options: VercelEdgeOptions = {}): void {
5254
5355 const client = vercelEdgeInit ( opts ) ;
5456
55- // Create/fork an isolation whenever we create root spans. This is ok because in Next.js we only create root spans on the edge for incoming requests.
5657 client ?. on ( 'spanStart' , span => {
58+ const spanAttributes = spanToJSON ( span ) . data ;
59+
60+ // Make sure middleware spans get the right op
61+ if ( spanAttributes ?. [ 'next.span_type' ] === 'Middleware.execute' ) {
62+ span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_OP , 'http.server.middleware' ) ;
63+ }
64+
65+ // Create/fork an isolation whenever we create root spans. This is ok because in Next.js we only create root spans on the edge for incoming requests.
5766 if ( span === getRootSpan ( span ) ) {
5867 const scopes = getCapturedScopesOnSpan ( span ) ;
5968
You can’t perform that action at this time.
0 commit comments