Remove BaggageManager for real. (#1929)

* Remove BaggageManager for real.

* Spot
This commit is contained in:
Anuraag Agrawal 2020-10-30 12:42:00 +09:00 committed by GitHub
parent 338acd4816
commit e6f6f19cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 56 deletions

View File

@ -1,48 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.api.baggage;
import io.opentelemetry.context.Scope;
import javax.annotation.concurrent.ThreadSafe;
/**
* Object for creating new {@link Baggage}s and {@code Baggage}s based on the current context.
*
* <p>This class returns {@link Baggage.Builder builders} that can be used to create the
* implementation-dependent {@link Baggage}s.
*
* <p>Implementations may have different constraints and are free to convert entry contexts to their
* own subtypes. This means callers cannot assume the {@link #getCurrentBaggage() current context}
* is the same instance as the one {@linkplain #withBaggage(Baggage) placed into scope}.
*/
@ThreadSafe
public interface BaggageManager {
/**
* Returns the current {@code Baggage}.
*
* @return the current {@code Baggage}.
*/
Baggage getCurrentBaggage();
/**
* Returns a new {@link Baggage.Builder}.
*
* @return a new {@code Baggage.Builder}.
*/
Baggage.Builder baggageBuilder();
/**
* Enters the scope of code where the given {@code Baggage} is in the current context (replacing
* the previous {@code Baggage}) and returns an object that represents that scope. The scope is
* exited when the returned object is closed.
*
* @param baggage the {@code Baggage} to be set as the current context.
* @return an object that defines a scope where the given {@code Baggage} is set as the current
* context.
*/
Scope withBaggage(Baggage baggage);
}

View File

@ -7,9 +7,7 @@ package io.opentelemetry.api.baggage.propagation;
import static java.util.Collections.singletonList;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.baggage.Baggage;
import io.opentelemetry.api.baggage.BaggageManager;
import io.opentelemetry.api.baggage.Entry;
import io.opentelemetry.api.baggage.EntryMetadata;
import io.opentelemetry.context.Context;
@ -26,10 +24,7 @@ public final class W3CBaggagePropagator implements TextMapPropagator {
private static final List<String> FIELDS = singletonList(FIELD);
private static final W3CBaggagePropagator INSTANCE = new W3CBaggagePropagator();
/**
* Singleton instance of the W3C Baggage Propagator. Uses the {@link BaggageManager} from the
* {@link OpenTelemetry} global.
*/
/** Singleton instance of the W3C Baggage Propagator. */
public static W3CBaggagePropagator getInstance() {
return INSTANCE;
}

View File

@ -8,7 +8,6 @@ package io.opentelemetry.sdk;
import static org.assertj.core.api.Assertions.assertThat;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.baggage.BaggageManager;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.metrics.MeterProvider;
import io.opentelemetry.api.trace.TracerProvider;
@ -29,7 +28,6 @@ class OpenTelemetrySdkTest {
@Mock private TracerProvider tracerProvider;
@Mock private MeterProvider meterProvider;
@Mock private BaggageManager baggageManager;
@Mock private ContextPropagators propagators;
@Mock private Clock clock;