File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -410,6 +410,11 @@ class LLMObs extends NoopLLMObs {
410410 }
411411 }
412412
413+ // When OTel tracing is enabled, add source:otel tag to allow backend to wait for OTel span conversion
414+ if ( isTrue ( getEnvironmentVariable ( 'DD_TRACE_OTEL_ENABLED' ) ) ) {
415+ evaluationTags . source = 'otel'
416+ }
417+
413418 const payload = {
414419 span_id : spanId ,
415420 trace_id : traceId ,
Original file line number Diff line number Diff line change @@ -1258,6 +1258,29 @@ describe('sdk', () => {
12581258 value : 'it is super toxic!'
12591259 } ) , { message : 'value must be a boolean for a boolean metric' } )
12601260 } )
1261+
1262+ describe ( 'with DD_TRACE_OTEL_ENABLED set' , ( ) => {
1263+ before ( ( ) => {
1264+ process . env . DD_TRACE_OTEL_ENABLED = 'true'
1265+ } )
1266+
1267+ after ( ( ) => {
1268+ delete process . env . DD_TRACE_OTEL_ENABLED
1269+ } )
1270+
1271+ it ( 'adds source:otel tag' , ( ) => {
1272+ llmobs . submitEvaluation ( spanCtx , {
1273+ mlApp : 'test' ,
1274+ timestampMs : 1234 ,
1275+ label : 'test' ,
1276+ metricType : 'score' ,
1277+ value : 0.6
1278+ } )
1279+
1280+ const evalMetric = LLMObsEvalMetricsWriter . prototype . append . getCall ( 0 ) . args [ 0 ]
1281+ assert . ok ( evalMetric . tags . includes ( 'source:otel' ) , 'Expected source:otel tag to be present' )
1282+ } )
1283+ } )
12611284 } )
12621285
12631286 describe ( 'flush' , ( ) => {
You can’t perform that action at this time.
0 commit comments