@@ -398,7 +398,7 @@ func OtelSpanConvertToSendSpan(ctx context.Context, spaceID string, resourceScop
398398 // set attributes
399399 calOtherAttribute (ctx , span , tagsString , tagsLong , tagsDouble , tagsBool )
400400 // set runtime
401- calRuntime (systemTagsString , resourceScopeSpan )
401+ calRuntime (systemTagsString , tagsString , resourceScopeSpan )
402402
403403 result := & LoopSpan {
404404 StartTime : startTimeUnixNanoInt64 / 1000 ,
@@ -544,12 +544,19 @@ func calOtherAttribute(ctx context.Context, span *Span, tagsString map[string]st
544544 }
545545}
546546
547- func calRuntime (systemTagsString map [string ]string , resourceScopeSpan * ResourceScopeSpan ) {
548- systemTagsString [tracespec .Runtime_ ] = getRuntime (resourceScopeSpan )
547+ func calRuntime (systemTagsString map [string ]string , tagsString map [ string ] string , resourceScopeSpan * ResourceScopeSpan ) {
548+ systemTagsString [tracespec .Runtime_ ] = getRuntime (tagsString , resourceScopeSpan )
549549}
550550
551- func getRuntime (resourceScopeSpan * ResourceScopeSpan ) string {
552- runtime := processRuntime (resourceScopeSpan )
551+ func getRuntime (tagsString map [string ]string , resourceScopeSpan * ResourceScopeSpan ) string {
552+ if len (tagsString ) > 0 {
553+ if runtime , ok := tagsString [otelAttributeSystemRuntime ]; ok && len (runtime ) > 0 {
554+ delete (tagsString , otelAttributeSystemRuntime )
555+ return runtime
556+ }
557+ }
558+
559+ runtime := processRuntimeByScope (resourceScopeSpan )
553560 marshalString , err := sonic .MarshalString (runtime )
554561 if err != nil {
555562 return "" // unexpected
@@ -558,7 +565,7 @@ func getRuntime(resourceScopeSpan *ResourceScopeSpan) string {
558565 return marshalString
559566}
560567
561- func processRuntime (resourceScopeSpan * ResourceScopeSpan ) * tracespec.Runtime {
568+ func processRuntimeByScope (resourceScopeSpan * ResourceScopeSpan ) * tracespec.Runtime {
562569 res := & tracespec.Runtime {
563570 Library : tracespec .VLibOpentelemetry ,
564571 Scene : "" ,
0 commit comments