@@ -20,10 +20,11 @@ import {
2020 ResourceType ,
2121} from 'omniboxd/resources/entities/resource.entity' ;
2222import { ChatResponse } from 'omniboxd/wizard/dto/chat-response.dto' ;
23- import { context , propagation } from '@opentelemetry/api' ;
23+ import { context , propagation , trace } from '@opentelemetry/api' ;
2424import { Share } from 'omniboxd/shares/entities/share.entity' ;
2525import { SharedResourcesService } from 'omniboxd/shared-resources/shared-resources.service' ;
2626import { ResourcesService } from 'omniboxd/resources/resources.service' ;
27+ import { Span } from 'nestjs-otel' ;
2728
2829interface HandlerContext {
2930 parentId ?: string ;
@@ -42,12 +43,18 @@ export class StreamService {
4243 private readonly resourcesService : ResourcesService ,
4344 ) { }
4445
46+ @Span ( 'stream' )
4547 async stream (
4648 url : string ,
4749 body : Record < string , any > ,
4850 requestId : string ,
4951 callback : ( data : string ) => Promise < void > ,
5052 ) : Promise < void > {
53+ const span = trace . getSpan ( context . active ( ) ) ;
54+ if ( span ) {
55+ span . setAttribute ( 'agent_request' , JSON . stringify ( body ) ) ;
56+ }
57+
5158 const traceHeaders : Record < string , string > = { } ;
5259 propagation . inject ( context . active ( ) , traceHeaders ) ;
5360 const response = await fetch ( `${ this . wizardBaseUrl } ${ url } ` , {
0 commit comments