Skip to content

4.x: Replace deprecated method Span.baggage(key) on Span.baggage().get(key) #9042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class JaegerBaggageTest {
void testBaggage(){
Span span = tracer.spanBuilder("test-span").start();
Span spanWithBaggage = span.baggage("key", "value");
Optional<String> result = spanWithBaggage.baggage("key");
Optional<String> result = spanWithBaggage.baggage().get("key");
assertThat(result.isPresent(), is(true));
assertThat(result.get(), equalTo("value"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public Span baggage(String key, String value) {

@Override
public Optional<String> baggage(String key) {
return delegate.baggage(key);
return delegate.baggage().get(key);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void testWritableBaggageFromSpan() {

baggage.set("keyB", "valB");
assertThat("Assigned baggage via baggage API value from span",
span.baggage("keyB"),
span.baggage().get("keyB"),
OptionalMatcher.optionalValue(is(equalTo("valB"))));
assertThat("Assigned via baggage API value is present", baggage.containsKey("keyB"), is(true));
assertThat("Assigned via baggage API value from baggage API",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void testIncomingBaggage() {
assertThat("Span context from inbound headers", spanContextOpt, OptionalMatcher.optionalPresent());
Span span = tracer.spanBuilder("inbound").parent(spanContextOpt.get()).start();
span.end();
assertThat("Inbound baggage bag1", span.baggage("bag1"), OptionalMatcher.optionalValue(is("val1")));
assertThat("Inbound baggage bag1", span.baggage("bag2"), OptionalMatcher.optionalValue(is("val2")));
assertThat("Inbound baggage bag1", span.baggage().get("bag1"), OptionalMatcher.optionalValue(is("val1")));
assertThat("Inbound baggage bag1", span.baggage().get("bag2"), OptionalMatcher.optionalValue(is("val2")));
}

@Test
Expand Down Expand Up @@ -161,7 +161,7 @@ void testBaggageAddedAfterActivation() {
}

private void checkBaggage(Tracer tracer, Span span, Supplier<SpanContext> spanContextSupplier) {
String value = span.baggage(BAGGAGE_KEY).orElseThrow();
String value = span.baggage().get(BAGGAGE_KEY).orElseThrow();
assertThat("baggage value right after set", value, Matchers.is(Matchers.equalTo(BAGGAGE_VALUE)));

// Inject the span (context) into the consumer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public Span baggage(String key, String value) {

@Override
public Optional<String> baggage(String key) {
return delegate.baggage(key);
return delegate.baggage().get(key);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void testWritableBaggageFromSpan() {

baggage.set("keyB", "valB");
assertThat("Assigned baggage via baggage API value from span",
span.baggage("keyB"),
span.baggage().get("keyB"),
OptionalMatcher.optionalValue(is(equalTo("valB"))));
assertThat("Assigned via baggage API value is present", baggage.containsKey("keyB"), is(true));
assertThat("Assigned via baggage API value from baggage API",
Expand Down