From 70f5b47f24aa82e089e65997c4c12760d3bbc9fa Mon Sep 17 00:00:00 2001 From: Andrei Arlou Date: Sat, 3 Aug 2024 16:22:45 +0300 Subject: [PATCH] 4.x: Replace deprecated method Span.baggage(key,value) on Span.baggage().set(key,value) --- .../tracing/providers/jaeger/JaegerBaggageTest.java | 10 +++++----- .../providers/opentelemetry/TestBaggageApi.java | 2 +- .../providers/opentelemetry/TestSpanAndBaggage.java | 2 +- .../tracing/providers/opentracing/TestBaggageApi.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tracing/providers/jaeger/src/test/java/io/helidon/tracing/providers/jaeger/JaegerBaggageTest.java b/tracing/providers/jaeger/src/test/java/io/helidon/tracing/providers/jaeger/JaegerBaggageTest.java index 84e06e90a61..00f308adb5a 100644 --- a/tracing/providers/jaeger/src/test/java/io/helidon/tracing/providers/jaeger/JaegerBaggageTest.java +++ b/tracing/providers/jaeger/src/test/java/io/helidon/tracing/providers/jaeger/JaegerBaggageTest.java @@ -39,8 +39,8 @@ class JaegerBaggageTest { @Test void testBaggage(){ Span span = tracer.spanBuilder("test-span").start(); - Span spanWithBaggage = span.baggage("key", "value"); - Optional result = spanWithBaggage.baggage().get("key"); + span.baggage().set("key", "value"); + Optional result = span.baggage().get("key"); assertThat(result.isPresent(), is(true)); assertThat(result.get(), equalTo("value")); @@ -49,8 +49,8 @@ void testBaggage(){ @Test void testBadBaggage(){ Span span = tracer.spanBuilder("test-bad-span").start(); - assertThrows(NullPointerException.class, () -> span.baggage(null, "value")); - assertThrows(NullPointerException.class, () -> span.baggage("key", null)); - assertThrows(NullPointerException.class, () -> span.baggage(null, null)); + assertThrows(NullPointerException.class, () -> span.baggage().set(null, "value")); + assertThrows(NullPointerException.class, () -> span.baggage().set("key", null)); + assertThrows(NullPointerException.class, () -> span.baggage().set(null, null)); } } diff --git a/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestBaggageApi.java b/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestBaggageApi.java index c0f2dca8401..a00b7654400 100644 --- a/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestBaggageApi.java +++ b/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestBaggageApi.java @@ -41,7 +41,7 @@ class TestBaggageApi { void testWritableBaggageFromSpan() { Span span = Tracer.global().spanBuilder("otel-span").start(); WritableBaggage baggage = span.baggage(); - span.baggage("keyA", "valA"); + span.baggage().set("keyA", "valA"); assertThat("Assigned baggage via span is present", baggage.containsKey("keyA"), is(true)); assertThat("Assigned baggage via span value from baggage", baggage.get("keyA"), diff --git a/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestSpanAndBaggage.java b/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestSpanAndBaggage.java index 4bedddf49b8..5cb4144b45d 100644 --- a/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestSpanAndBaggage.java +++ b/tracing/providers/opentelemetry/src/test/java/io/helidon/tracing/providers/opentelemetry/TestSpanAndBaggage.java @@ -83,7 +83,7 @@ void testActiveSpanScopeWithBaggage() { currentJustAfterActivation.get().context().spanId(), is(outerSpan.context().spanId())); - outerSpan.baggage("myItem", "myValue"); + outerSpan.baggage().set("myItem", "myValue"); outerSpan.end(); } catch (Exception e) { outerSpan.end(e); diff --git a/tracing/providers/opentracing/src/test/java/io/helidon/tracing/providers/opentracing/TestBaggageApi.java b/tracing/providers/opentracing/src/test/java/io/helidon/tracing/providers/opentracing/TestBaggageApi.java index cbb1bd76629..bd4a747c6bc 100644 --- a/tracing/providers/opentracing/src/test/java/io/helidon/tracing/providers/opentracing/TestBaggageApi.java +++ b/tracing/providers/opentracing/src/test/java/io/helidon/tracing/providers/opentracing/TestBaggageApi.java @@ -40,7 +40,7 @@ class TestBaggageApi { void testWritableBaggageFromSpan() { Span span = io.helidon.tracing.Tracer.global().spanBuilder("otel-span").start(); WritableBaggage baggage = span.baggage(); - span.baggage("keyA", "valA"); + span.baggage().set("keyA", "valA"); assertThat("Assigned baggage via span is present", baggage.containsKey("keyA"), is(true)); assertThat("Assigned baggage via span value from baggage", baggage.get("keyA"),