Skip to content

Commit f8486a1

Browse files
committed
ENGTAI-40849: Add service.instance.id attribute in SpanFromContext function
This is used by the otel http and grpc instrumentation. StartSpan already adds service.instance.id attribute. So adding it in SpanFromContext as well
1 parent 0dd308a commit f8486a1

File tree

1 file changed

+3
-1
lines changed
  • instrumentation/opentelemetry

1 file changed

+3
-1
lines changed

instrumentation/opentelemetry/span.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ func (s *Span) GetSpanId() string {
117117
}
118118

119119
func SpanFromContext(ctx context.Context) sdk.Span {
120-
return &Span{trace.SpanFromContext(ctx)}
120+
span := &Span{trace.SpanFromContext(ctx)}
121+
span.SetAttributes(identifier.ServiceInstanceKeyValue)
122+
return span
121123
}
122124

123125
type getTracerProvider func() trace.TracerProvider

0 commit comments

Comments
 (0)