Skip to content

Commit

Permalink
chore: remove binary propagator (#804)
Browse files Browse the repository at this point in the history
* chore: remove binary format

Co-authored-by: Daniel Dyla <[email protected]>
  • Loading branch information
mayurkale22 and dyladan authored Feb 27, 2020
1 parent e2f971d commit a34d03a
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 419 deletions.
36 changes: 0 additions & 36 deletions packages/opentelemetry-api/src/context/propagation/BinaryFormat.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import { Carrier } from './carrier';

/**
* Injects {@link Context} into and extracts it from carriers that travel
* in-band across process boundaries. Encoding is expected to conform to the HTTP
* Header Field semantics. Values are often encoded as RPC/HTTP request headers.
* in-band across process boundaries. Encoding is expected to conform to the
* HTTP Header Field semantics. Values are often encoded as RPC/HTTP request
* headers.
*
* The carrier of propagated data on both the client (injector) and server
* (extractor) side is usually an object such as http headers.
Expand All @@ -29,20 +30,25 @@ export interface HttpTextFormat {
/**
* Injects values from a given {@link Context} into a carrier.
*
* OpenTelemetry defines a common set of format values (BinaryFormat and
* HTTPTextFormat), and each has an expected `carrier` type.
* OpenTelemetry defines a common set of format values (HTTPTextFormat), and
* each has an expected `carrier` type.
*
* @param context the Context from which to extract values to transmit over the wire.
* @param carrier the carrier of propagation fields, such as http request headers.
* @param context the Context from which to extract values to transmit over
* the wire.
* @param carrier the carrier of propagation fields, such as http request
* headers.
*/
inject(context: Context, carrier: Carrier): void;

/**
* Given a {@link Context} and a carrier, extract context values from a carrier and
* return a new context, created from the old context, with the extracted values.
* Given a {@link Context} and a carrier, extract context values from a
* carrier and return a new context, created from the old context, with the
* extracted values.
*
* @param context the Context from which to extract values to transmit over the wire.
* @param carrier the carrier of propagation fields, such as http request headers.
* @param context the Context from which to extract values to transmit over
* the wire.
* @param carrier the carrier of propagation fields, such as http request
* headers.
*/
extract(context: Context, carrier: Carrier): Context;
}

This file was deleted.

1 change: 0 additions & 1 deletion packages/opentelemetry-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

export * from './common/Logger';
export * from './common/Time';
export * from './context/propagation/BinaryFormat';
export * from './context/propagation/carrier';
export * from './context/propagation/HttpTextFormat';
export * from './distributed_context/DistributedContext';
Expand Down
8 changes: 1 addition & 7 deletions packages/opentelemetry-api/src/trace/NoopTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { BinaryFormat, HttpTextFormat, Span, SpanOptions, Tracer } from '..';
import { NOOP_BINARY_FORMAT } from '../context/propagation/NoopBinaryFormat';
import { HttpTextFormat, Span, SpanOptions, Tracer } from '..';
import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextFormat';
import { NOOP_SPAN } from './NoopSpan';

Expand Down Expand Up @@ -43,11 +42,6 @@ export class NoopTracer implements Tracer {
return target;
}

// By default does nothing
getBinaryFormat(): BinaryFormat {
return NOOP_BINARY_FORMAT;
}

// By default does nothing
getHttpTextFormat(): HttpTextFormat {
return NOOP_HTTP_TEXT_FORMAT;
Expand Down
14 changes: 0 additions & 14 deletions packages/opentelemetry-api/src/trace/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { HttpTextFormat } from '../context/propagation/HttpTextFormat';
import { BinaryFormat } from '../context/propagation/BinaryFormat';
import { Span } from './span';
import { SpanOptions } from './SpanOptions';

Expand Down Expand Up @@ -65,19 +64,6 @@ export interface Tracer {
*/
bind<T>(target: T, span?: Span): T;

/**
* Returns the {@link BinaryFormat} interface which can serialize/deserialize
* Spans.
*
* If no tracer implementation is provided, this defaults to the W3C Trace
* Context binary format {@link BinaryFormat}. For more details see
* <a href="https://w3c.github.io/trace-context-binary/">W3C Trace Context
* binary protocol</a>.
*
* @returns the {@link BinaryFormat} for this implementation.
*/
getBinaryFormat(): BinaryFormat;

/**
* Returns the {@link HttpTextFormat} interface which can inject/extract
* Spans.
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-api/test/api/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ describe('API', () => {
'getCurrentSpan',
'startSpan',
'withSpan',
'getBinaryFormat',
'getHttpTextFormat',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Context } from '@opentelemetry/scope-base';

describe('NoopTracer', () => {
it('should not crash', () => {
const spanContext = { traceId: '', spanId: '' };
const tracer = new NoopTracer();

assert.deepStrictEqual(tracer.startSpan('span-name'), NOOP_SPAN);
Expand All @@ -45,11 +44,6 @@ describe('NoopTracer', () => {
httpTextFormat.extract(Context.ROOT_CONTEXT, {}),
Context.ROOT_CONTEXT
);

const binaryFormat = tracer.getBinaryFormat();
assert.ok(binaryFormat);
assert.ok(binaryFormat.toBytes(spanContext), typeof ArrayBuffer);
assert.deepStrictEqual(binaryFormat.fromBytes(new ArrayBuffer(0)), null);
});

it('should not crash when .withSpan()', done => {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/opentelemetry-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export * from './common/types';
export * from './version';
export * from './context/context';
export * from './context/propagation/B3Format';
export * from './context/propagation/BinaryTraceContext';
export * from './context/propagation/HttpTraceContext';
export * from './platform';
export * from './trace/instrumentation/BasePlugin';
Expand Down
Loading

0 comments on commit a34d03a

Please sign in to comment.