diff --git a/api/src/main/java/io/opentelemetry/correlationcontext/CorrelationContextManager.java b/api/src/main/java/io/opentelemetry/correlationcontext/CorrelationContextManager.java index a6b4a525c9..e9a4319524 100644 --- a/api/src/main/java/io/opentelemetry/correlationcontext/CorrelationContextManager.java +++ b/api/src/main/java/io/opentelemetry/correlationcontext/CorrelationContextManager.java @@ -17,7 +17,6 @@ package io.opentelemetry.correlationcontext; import io.opentelemetry.context.Scope; -import io.opentelemetry.context.propagation.BinaryFormat; import io.opentelemetry.context.propagation.HttpTextFormat; import javax.annotation.concurrent.ThreadSafe; @@ -65,45 +64,6 @@ public interface CorrelationContextManager { */ Scope withContext(CorrelationContext distContext); - /** - * Returns the {@link BinaryFormat} for this implementation. - * - *
Example of usage on the client: - * - *
{@code
- * private static final CorrelationContextManager contextManager =
- * OpenTelemetry.getCorrelationContextManager();
- * private static final BinaryFormat binaryFormat = contextManager.getBinaryFormat();
- *
- * Request createRequest() {
- * Request req = new Request();
- * byte[] ctxBuffer = binaryFormat.toByteArray(contextManager.getCurrentContext());
- * request.addMetadata("distributedContext", ctxBuffer);
- * return request;
- * }
- * }
- *
- * Example of usage on the server: - * - *
{@code
- * private static final CorrelationContextManager contextManager =
- * OpenTelemetry.getCorrelationContextManager();
- * private static final BinaryFormat binaryFormat = contextManager.getBinaryFormat();
- *
- * void onRequestReceived(Request request) {
- * byte[] ctxBuffer = request.getMetadata("distributedContext");
- * CorrelationContext distContext = textFormat.fromByteArray(ctxBuffer);
- * try (Scope s = contextManager.withContext(distContext)) {
- * // Handle request and send response back.
- * }
- * }
- * }
- *
- * @return the {@code BinaryFormat} for this implementation.
- * @since 0.1.0
- */
- BinaryFormatIf no tracer implementation is provided, this defaults to the W3C Trace Context binary - * format. For more details see W3C Trace - * Context binary protocol. - * - *
Example of usage on the client: - * - *
{@code
- * private static final Tracer tracer = OpenTelemetry.getTracer();
- * private static final BinaryFormat binaryFormat = tracer.getBinaryFormat();
- * void onSendRequest() {
- * Span span = tracer.spanBuilder("MyRequest").setSpanKind(Span.Kind.CLIENT).startSpan();
- * try (Scope ss = tracer.withSpan(span)) {
- * byte[] binaryValue = binaryFormat.toByteArray(tracer.getCurrentContext().context());
- * // Send the request including the binaryValue and wait for the response.
- * } finally {
- * span.end();
- * }
- * }
- * }
- *
- * Example of usage on the server: - * - *
{@code
- * private static final Tracer tracer = OpenTelemetry.getTracer();
- * private static final BinaryFormat binaryFormat = tracer.getBinaryFormat();
- * void onRequestReceived() {
- * // Get the binaryValue from the request.
- * SpanContext spanContext = SpanContext.INVALID;
- * if (binaryValue != null) {
- * spanContext = binaryFormat.fromByteArray(binaryValue);
- * }
- * Span span = tracer.spanBuilder("MyRequest")
- * .setParent(spanContext)
- * .setSpanKind(Span.Kind.SERVER).startSpan();
- * try (Scope ss = tracer.withSpan(span)) {
- * // Handle request and send response back.
- * } finally {
- * span.end();
- * }
- * }
- * }
- *
- * @return the {@code BinaryFormat} for this implementation.
- * @since 0.1.0
- */
- BinaryFormatFormat: - * - *
If the value could not be parsed, the underlying implementation will decide to return ether
- * an empty value, an invalid value, or a valid value.
- *
- * @param bytes on-the-wire representation of the value.
- * @return a value deserialized from {@code bytes}.
- * @since 0.1.0
- */
- V fromByteArray(byte[] bytes);
-}
diff --git a/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java b/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java
index eeb7ea2d43..2852cc5803 100644
--- a/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java
+++ b/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java
@@ -17,10 +17,8 @@
package io.opentelemetry.opentracingshim;
import io.opentelemetry.context.propagation.HttpTextFormat;
-import io.opentracing.propagation.Binary;
import io.opentracing.propagation.TextMapExtract;
import io.opentracing.propagation.TextMapInject;
-import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
@@ -79,19 +77,4 @@ final class Propagation extends BaseShimObject {
return carrier.get(key);
}
}
-
- public void injectBinaryFormat(SpanContextShim context, Binary carrier) {
- byte[] contextBuff = tracer().getBinaryFormat().toByteArray(context.getSpanContext());
- ByteBuffer byteBuff = carrier.injectionBuffer(contextBuff.length);
- byteBuff.put(contextBuff);
- }
-
- public SpanContextShim extractBinaryFormat(Binary carrier) {
-
- ByteBuffer byteBuff = carrier.extractionBuffer();
- byte[] buff = new byte[byteBuff.remaining()];
- byteBuff.get(buff);
-
- return new SpanContextShim(telemetryInfo, tracer().getBinaryFormat().fromByteArray(buff));
- }
}
diff --git a/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java b/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java
index ef410ccac1..7aa8956a92 100644
--- a/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java
+++ b/opentracing_shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java
@@ -21,7 +21,6 @@ import io.opentracing.ScopeManager;
import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
-import io.opentracing.propagation.Binary;
import io.opentracing.propagation.Format;
import io.opentracing.propagation.TextMapExtract;
import io.opentracing.propagation.TextMapInject;
@@ -73,8 +72,6 @@ final class TracerShim extends BaseShimObject implements Tracer {
|| format == Format.Builtin.TEXT_MAP_INJECT
|| format == Format.Builtin.HTTP_HEADERS) {
propagation.injectTextFormat(contextShim, (TextMapInject) carrier);
- } else if (format == Format.Builtin.BINARY) {
- propagation.injectBinaryFormat(contextShim, (Binary) carrier);
}
}
@@ -86,8 +83,6 @@ final class TracerShim extends BaseShimObject implements Tracer {
|| format == Format.Builtin.TEXT_MAP_EXTRACT
|| format == Format.Builtin.HTTP_HEADERS) {
return propagation.extractTextFormat((TextMapExtract) carrier);
- } else if (format == Format.Builtin.BINARY) {
- return propagation.extractBinaryFormat((Binary) carrier);
}
} catch (Exception e) {
logger.log(
diff --git a/sdk/src/main/java/io/opentelemetry/sdk/correlationcontext/CorrelationContextManagerSdk.java b/sdk/src/main/java/io/opentelemetry/sdk/correlationcontext/CorrelationContextManagerSdk.java
index b7938beae4..e80737bbd0 100644
--- a/sdk/src/main/java/io/opentelemetry/sdk/correlationcontext/CorrelationContextManagerSdk.java
+++ b/sdk/src/main/java/io/opentelemetry/sdk/correlationcontext/CorrelationContextManagerSdk.java
@@ -17,7 +17,6 @@
package io.opentelemetry.sdk.correlationcontext;
import io.opentelemetry.context.Scope;
-import io.opentelemetry.context.propagation.BinaryFormat;
import io.opentelemetry.context.propagation.HttpTextFormat;
import io.opentelemetry.correlationcontext.CorrelationContext;
import io.opentelemetry.correlationcontext.CorrelationContextManager;
@@ -44,12 +43,6 @@ public class CorrelationContextManagerSdk implements CorrelationContextManager {
return ContextUtils.withCorrelationContext(distContext);
}
- @Override
- public BinaryFormat