File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
agents-api/src/middleware Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @inkeep/agents-api " : patch
3+ ---
4+
5+ adding app.id to span attributes
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 verifySlackUserToken ,
1414 verifyTempToken ,
1515} from '@inkeep/agents-core' ;
16+ import { trace } from '@opentelemetry/api' ;
1617import { createMiddleware } from 'hono/factory' ;
1718import { HTTPException } from 'hono/http-exception' ;
1819import { errors , jwtVerify } from 'jose' ;
@@ -708,6 +709,9 @@ async function runApiKeyAuthHandler(
708709 c . set ( 'executionContext' , buildExecutionContext ( createDevContext ( reqData ) , reqData ) ) ;
709710 }
710711
712+ if ( reqData . appId && attempt . authResult ) {
713+ trace . getActiveSpan ( ) ?. setAttribute ( 'app.id' , reqData . appId ) ;
714+ }
711715 await next ( ) ;
712716 return ;
713717 }
@@ -757,6 +761,9 @@ async function runApiKeyAuthHandler(
757761 ) ;
758762
759763 c . set ( 'executionContext' , buildExecutionContext ( attempt . authResult , reqData ) ) ;
764+ if ( reqData . appId ) {
765+ trace . getActiveSpan ( ) ?. setAttribute ( 'app.id' , reqData . appId ) ;
766+ }
760767 await next ( ) ;
761768}
762769
You can’t perform that action at this time.
0 commit comments