Skip to content

Commit 6da19a2

Browse files
committed
fix: add not null check for baggage
1 parent 4e24798 commit 6da19a2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

opentelemetry/src/main/java/io/grpc/opentelemetry/OpenTelemetryMetricsModule.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,11 @@ private static final class ServerTracer extends ServerStreamTracer {
558558
@Override
559559
public io.grpc.Context filterContext(io.grpc.Context context) {
560560
Baggage baggage = BAGGAGE_KEY.get(context);
561-
if (baggage == null) {
562-
throw new IllegalStateException("Baggage from OpenTelemetryTracingModule is missing");
561+
if (baggage != null) {
562+
otelContext = Context.current().with(baggage);
563+
} else {
564+
otelContext = Context.current();
563565
}
564-
otelContext = Context.current().with(baggage);
565566
return context;
566567
}
567568

0 commit comments

Comments
 (0)