@@ -12,7 +12,7 @@ import {
1212 spanToJSON ,
1313 startSpan ,
1414} from '@sentry/core' ;
15- import { CODE_FUNCTION_NAME , HTTP_ROUTE } from '@sentry/conventions/attributes' ;
15+ import { CODE_FUNCTION_NAME , HTTP_ROUTE , KOA_NAME , KOA_TYPE } from '@sentry/conventions/attributes' ;
1616import { DEBUG_BUILD } from '../../debug-build' ;
1717import { CHANNELS } from '../../orchestrion/channels' ;
1818
@@ -21,13 +21,6 @@ const INTEGRATION_NAME = 'Koa' as const;
2121
2222const ORIGIN = 'auto.http.orchestrion.koa' ;
2323
24- // `koa.type` (a layer's role) has no `@sentry/conventions` equivalent, so it stays
25- // the canonical attribute — kept in sync with the OTel koa integration so spans are
26- // identical across both code paths.
27- const ATTR_KOA_TYPE = 'koa.type' ;
28- // TODO(v11): remove this attribute.
29- const ATTR_KOA_NAME = 'koa.name' ;
30-
3124const LAYER_TYPE = {
3225 ROUTER : 'router' ,
3326 MIDDLEWARE : 'middleware' ,
@@ -180,7 +173,7 @@ function patchLayer(
180173 setHttpServerSpanRouteAttribute ( context . _matchedRoute . toString ( ) ) ;
181174 }
182175
183- const koaName = metadata . attributes [ ATTR_KOA_NAME ] ;
176+ const koaName = metadata . attributes [ KOA_NAME ] ;
184177 // Somehow, name is sometimes `''` for middleware spans.
185178 // See: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2220
186179 const name = typeof koaName === 'string' ? koaName || '< unknown >' : metadata . name ;
@@ -217,17 +210,17 @@ function getMiddlewareMetadata(
217210 if ( isRouter ) {
218211 return {
219212 attributes : {
220- [ ATTR_KOA_NAME ] : layerPath ?. toString ( ) , // TODO(v11): remove, replaced by http.route
221- [ ATTR_KOA_TYPE ] : LAYER_TYPE . ROUTER ,
213+ [ KOA_NAME ] : layerPath ?. toString ( ) , // TODO(v11): remove, replaced by http.route
214+ [ KOA_TYPE ] : LAYER_TYPE . ROUTER ,
222215 [ HTTP_ROUTE ] : layerPath ?. toString ( ) ,
223216 } ,
224217 name : context . _matchedRouteName || `router - ${ layerPath } ` ,
225218 } ;
226219 }
227220 return {
228221 attributes : {
229- [ ATTR_KOA_NAME ] : layer . name || 'middleware' , // TODO(v11): remove, replaced by code.function.name
230- [ ATTR_KOA_TYPE ] : LAYER_TYPE . MIDDLEWARE ,
222+ [ KOA_NAME ] : layer . name || 'middleware' , // TODO(v11): remove, replaced by code.function.name
223+ [ KOA_TYPE ] : LAYER_TYPE . MIDDLEWARE ,
231224 [ CODE_FUNCTION_NAME ] : layer . name || 'middleware' ,
232225 } ,
233226 name : `middleware - ${ layer . name } ` ,
0 commit comments