From 2c3343070472e13cbd2b676eeac6c1cba416a7a7 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 12 Mar 2020 10:08:08 -0400 Subject: [PATCH 1/5] chore: rename formatter to propagator --- benchmark/README.md | 2 +- benchmark/propagator.js | 4 +-- .../examples/user-interaction/index.js | 4 +-- .../examples/xml-http-request/index.js | 4 +-- .../opentelemetry-api/src/api/propagation.ts | 8 ++--- ...ttpTextFormat.ts => HttpTextPropagator.ts} | 4 +-- ...extFormat.ts => NoopHttpTextPropagator.ts} | 8 ++--- packages/opentelemetry-api/src/index.ts | 4 +-- .../opentelemetry-api/src/trace/NoopTracer.ts | 6 ++-- .../opentelemetry-api/test/api/api.test.ts | 2 +- .../noop-implementations/noop-tracer.test.ts | 8 ++--- .../{B3Format.ts => B3Propagator.ts} | 4 +-- .../context/propagation/HttpTraceContext.ts | 4 +-- .../src/context/propagation/composite.ts | 6 ++-- .../src/context/propagation/types.ts | 4 +-- packages/opentelemetry-core/src/index.ts | 2 +- ...{B3Format.test.ts => B3Propagator.test.ts} | 34 +++++++++---------- .../test/context/composite.test.ts | 12 +++---- .../test/registration.test.ts | 8 ++--- .../src/enums/Format.ts | 19 ----------- .../opentelemetry-plugin-http/src/index.ts | 1 - .../test/utils/DummyPropagation.ts | 4 +-- .../test/utils/DummyPropagation.ts | 4 +-- .../src/enums/Format.ts | 19 ----------- .../test/xhr.test.ts | 4 +-- .../opentelemetry-propagator-jaeger/README.md | 4 +-- ...Format.ts => JaegerHttpTracePropagator.ts} | 4 +-- .../src/index.ts | 2 +- ...t.ts => JaegerHttpTracePropagator.test.ts} | 26 +++++++------- packages/opentelemetry-tracing/src/types.ts | 4 +-- .../test/registration.test.ts | 8 ++--- 31 files changed, 94 insertions(+), 133 deletions(-) rename packages/opentelemetry-api/src/context/propagation/{HttpTextFormat.ts => HttpTextPropagator.ts} (94%) rename packages/opentelemetry-api/src/context/propagation/{NoopHttpTextFormat.ts => NoopHttpTextPropagator.ts} (79%) rename packages/opentelemetry-core/src/context/propagation/{B3Format.ts => B3Propagator.ts} (97%) rename packages/opentelemetry-core/test/context/{B3Format.test.ts => B3Propagator.test.ts} (89%) delete mode 100644 packages/opentelemetry-plugin-http/src/enums/Format.ts delete mode 100644 packages/opentelemetry-plugin-xml-http-request/src/enums/Format.ts rename packages/opentelemetry-propagator-jaeger/src/{JaegerHttpTraceFormat.ts => JaegerHttpTracePropagator.ts} (97%) rename packages/opentelemetry-propagator-jaeger/test/{JaegerHttpTraceFormat.test.ts => JaegerHttpTracePropagator.test.ts} (88%) diff --git a/benchmark/README.md b/benchmark/README.md index ca9147c895..5557658a16 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -53,7 +53,7 @@ Beginning BasicTracerProvider with BatchSpanProcessor Benchmark... #startSpan with 100 attributes x 3,459 ops/sec ±4.56% (20 runs sampled) -Beginning B3Format Benchmark... +Beginning B3Propagator Benchmark... 2 tests completed. #Inject x 5,086,366 ops/sec ±3.18% (100 runs sampled) diff --git a/benchmark/propagator.js b/benchmark/propagator.js index 0c5c137c26..8d7cc2b4ae 100644 --- a/benchmark/propagator.js +++ b/benchmark/propagator.js @@ -5,8 +5,8 @@ const opentelemetry = require('../packages/opentelemetry-core'); const setups = [ { - name: 'B3Format', - propagator: new opentelemetry.B3Format(), + name: 'B3Propagator', + propagator: new opentelemetry.B3Propagator(), injectCarrier: {}, extractCarrier: { 'x-b3-traceid': 'd4cda95b652f4a1592b449d5929fda1b', diff --git a/examples/tracer-web/examples/user-interaction/index.js b/examples/tracer-web/examples/user-interaction/index.js index 2e764f5cf0..524e8ed077 100644 --- a/examples/tracer-web/examples/user-interaction/index.js +++ b/examples/tracer-web/examples/user-interaction/index.js @@ -4,10 +4,10 @@ import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request'; import { UserInteractionPlugin } from '@opentelemetry/plugin-user-interaction'; import { ZoneScopeManager } from '@opentelemetry/scope-zone'; import { CollectorExporter } from '@opentelemetry/exporter-collector'; -import { B3Format } from '@opentelemetry/core'; +import { B3Propagator } from '@opentelemetry/core'; const providerWithZone = new WebTracerProvider({ - httpTextFormat: new B3Format(), + HttpTextPropagator: new B3Propagator(), scopeManager: new ZoneScopeManager(), plugins: [ new UserInteractionPlugin(), diff --git a/examples/tracer-web/examples/xml-http-request/index.js b/examples/tracer-web/examples/xml-http-request/index.js index 3ad74ea04c..1a23b8d104 100644 --- a/examples/tracer-web/examples/xml-http-request/index.js +++ b/examples/tracer-web/examples/xml-http-request/index.js @@ -3,10 +3,10 @@ import { WebTracerProvider } from '@opentelemetry/web'; import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request'; import { ZoneScopeManager } from '@opentelemetry/scope-zone'; import { CollectorExporter } from '@opentelemetry/exporter-collector'; -import { B3Format } from '@opentelemetry/core'; +import { B3Propagator } from '@opentelemetry/core'; const providerWithZone = new WebTracerProvider({ - httpTextFormat: new B3Format(), + HttpTextPropagator: new B3Propagator(), scopeManager: new ZoneScopeManager(), plugins: [ new XMLHttpRequestPlugin({ diff --git a/packages/opentelemetry-api/src/api/propagation.ts b/packages/opentelemetry-api/src/api/propagation.ts index d655db4c86..9df2d6532e 100644 --- a/packages/opentelemetry-api/src/api/propagation.ts +++ b/packages/opentelemetry-api/src/api/propagation.ts @@ -16,8 +16,8 @@ import { Context } from '@opentelemetry/scope-base'; import { defaultGetter, GetterFunction } from '../context/propagation/getter'; -import { HttpTextFormat } from '../context/propagation/HttpTextFormat'; -import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextFormat'; +import { HttpTextPropagator } from '../context/propagation/HttpTextPropagator'; +import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextPropagator'; import { defaultSetter, SetterFunction } from '../context/propagation/setter'; import { ContextAPI } from './context'; @@ -28,7 +28,7 @@ const contextApi = ContextAPI.getInstance(); */ export class PropagationAPI { private static _instance?: PropagationAPI; - private _propagator: HttpTextFormat = NOOP_HTTP_TEXT_FORMAT; + private _propagator: HttpTextPropagator = NOOP_HTTP_TEXT_FORMAT; /** Empty private constructor prevents end users from constructing a new instance of the API */ private constructor() {} @@ -45,7 +45,7 @@ export class PropagationAPI { /** * Set the current propagator. Returns the initialized propagator */ - public setGlobalPropagator(propagator: HttpTextFormat): HttpTextFormat { + public setGlobalPropagator(propagator: HttpTextPropagator): HttpTextPropagator { this._propagator = propagator; return propagator; } diff --git a/packages/opentelemetry-api/src/context/propagation/HttpTextFormat.ts b/packages/opentelemetry-api/src/context/propagation/HttpTextPropagator.ts similarity index 94% rename from packages/opentelemetry-api/src/context/propagation/HttpTextFormat.ts rename to packages/opentelemetry-api/src/context/propagation/HttpTextPropagator.ts index efd1e4efab..0969906901 100644 --- a/packages/opentelemetry-api/src/context/propagation/HttpTextFormat.ts +++ b/packages/opentelemetry-api/src/context/propagation/HttpTextPropagator.ts @@ -27,11 +27,11 @@ import { GetterFunction } from './getter'; * The carrier of propagated data on both the client (injector) and server * (extractor) side is usually an object such as http headers. */ -export interface HttpTextFormat { +export interface HttpTextPropagator { /** * Injects values from a given {@link Context} into a carrier. * - * OpenTelemetry defines a common set of format values (HTTPTextFormat), and + * OpenTelemetry defines a common set of format values (HttpTextPropagator), and * each has an expected `carrier` type. * * @param context the Context from which to extract values to transmit over diff --git a/packages/opentelemetry-api/src/context/propagation/NoopHttpTextFormat.ts b/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts similarity index 79% rename from packages/opentelemetry-api/src/context/propagation/NoopHttpTextFormat.ts rename to packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts index 4978cc0fbc..7243c7314f 100644 --- a/packages/opentelemetry-api/src/context/propagation/NoopHttpTextFormat.ts +++ b/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts @@ -15,12 +15,12 @@ */ import { Context } from '@opentelemetry/scope-base'; -import { HttpTextFormat } from './HttpTextFormat'; +import { HttpTextPropagator } from './HttpTextPropagator'; /** - * No-op implementations of {@link HttpTextFormat}. + * No-op implementations of {@link HttpTextPropagator}. */ -export class NoopHttpTextFormat implements HttpTextFormat { +export class NoopHttpTextPropagator implements HttpTextPropagator { /** Noop inject function does nothing */ inject(context: Context, carrier: unknown, setter: Function): void {} /** Noop extract function does nothing and returns the input context */ @@ -29,4 +29,4 @@ export class NoopHttpTextFormat implements HttpTextFormat { } } -export const NOOP_HTTP_TEXT_FORMAT = new NoopHttpTextFormat(); +export const NOOP_HTTP_TEXT_FORMAT = new NoopHttpTextPropagator(); diff --git a/packages/opentelemetry-api/src/index.ts b/packages/opentelemetry-api/src/index.ts index 114bf875ff..cc1543247f 100644 --- a/packages/opentelemetry-api/src/index.ts +++ b/packages/opentelemetry-api/src/index.ts @@ -17,8 +17,8 @@ export * from './common/Logger'; export * from './common/Time'; export * from './context/propagation/getter'; -export * from './context/propagation/HttpTextFormat'; -export * from './context/propagation/NoopHttpTextFormat'; +export * from './context/propagation/HttpTextPropagator'; +export * from './context/propagation/NoopHttpTextPropagator'; export * from './context/propagation/setter'; export * from './correlation_context/CorrelationContext'; export * from './correlation_context/EntryValue'; diff --git a/packages/opentelemetry-api/src/trace/NoopTracer.ts b/packages/opentelemetry-api/src/trace/NoopTracer.ts index b1928ee889..0df1917b41 100644 --- a/packages/opentelemetry-api/src/trace/NoopTracer.ts +++ b/packages/opentelemetry-api/src/trace/NoopTracer.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { HttpTextFormat, Span, SpanOptions, Tracer } from '..'; -import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextFormat'; +import { HttpTextPropagator, Span, SpanOptions, Tracer } from '..'; +import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextPropagator'; import { NOOP_SPAN } from './NoopSpan'; /** @@ -43,7 +43,7 @@ export class NoopTracer implements Tracer { } // By default does nothing - getHttpTextFormat(): HttpTextFormat { + getHttpTextPropagator(): HttpTextPropagator { return NOOP_HTTP_TEXT_FORMAT; } } diff --git a/packages/opentelemetry-api/test/api/api.test.ts b/packages/opentelemetry-api/test/api/api.test.ts index dd21065689..d68a85f98b 100644 --- a/packages/opentelemetry-api/test/api/api.test.ts +++ b/packages/opentelemetry-api/test/api/api.test.ts @@ -29,7 +29,7 @@ describe('API', () => { 'getCurrentSpan', 'startSpan', 'withSpan', - 'getHttpTextFormat', + 'getHttpTextPropagator', ]; it('should expose a tracer provider via getTracerProvider', () => { diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts index f1e28be91f..48720d5845 100644 --- a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts +++ b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts @@ -37,12 +37,12 @@ describe('NoopTracer', () => { ); assert.deepStrictEqual(tracer.getCurrentSpan(), NOOP_SPAN); - const httpTextFormat = tracer.getHttpTextFormat(); - assert.ok(httpTextFormat); + const HttpTextPropagator = tracer.getHttpTextPropagator(); + assert.ok(HttpTextPropagator); - httpTextFormat.inject(Context.ROOT_CONTEXT, {}, defaultSetter); + HttpTextPropagator.inject(Context.ROOT_CONTEXT, {}, defaultSetter); assert.deepStrictEqual( - httpTextFormat.extract(Context.ROOT_CONTEXT, {}, defaultGetter), + HttpTextPropagator.extract(Context.ROOT_CONTEXT, {}, defaultGetter), Context.ROOT_CONTEXT ); }); diff --git a/packages/opentelemetry-core/src/context/propagation/B3Format.ts b/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts similarity index 97% rename from packages/opentelemetry-core/src/context/propagation/B3Format.ts rename to packages/opentelemetry-core/src/context/propagation/B3Propagator.ts index 08ee1e89b4..b3c971b87f 100644 --- a/packages/opentelemetry-core/src/context/propagation/B3Format.ts +++ b/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts @@ -17,7 +17,7 @@ import { Context, GetterFunction, - HttpTextFormat, + HttpTextPropagator, SetterFunction, TraceFlags, } from '@opentelemetry/api'; @@ -42,7 +42,7 @@ function isValidSpanId(spanId: string): boolean { * Propagator for the B3 HTTP header format. * Based on: https://github.com/openzipkin/b3-propagation */ -export class B3Format implements HttpTextFormat { +export class B3Propagator implements HttpTextPropagator { inject(context: Context, carrier: unknown, setter: SetterFunction) { const spanContext = getParentSpanContext(context); if (!spanContext) return; diff --git a/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts b/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts index e4bd3af94d..d8b78d0fc2 100644 --- a/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts +++ b/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts @@ -17,7 +17,7 @@ import { Context, GetterFunction, - HttpTextFormat, + HttpTextPropagator, SetterFunction, SpanContext, TraceFlags, @@ -63,7 +63,7 @@ export function parseTraceParent(traceParent: string): SpanContext | null { * Based on the Trace Context specification: * https://www.w3.org/TR/trace-context/ */ -export class HttpTraceContext implements HttpTextFormat { +export class HttpTraceContext implements HttpTextPropagator { inject(context: Context, carrier: unknown, setter: SetterFunction) { const spanContext = getParentSpanContext(context); if (!spanContext) return; diff --git a/packages/opentelemetry-core/src/context/propagation/composite.ts b/packages/opentelemetry-core/src/context/propagation/composite.ts index 0979021fb6..c6010b319e 100644 --- a/packages/opentelemetry-core/src/context/propagation/composite.ts +++ b/packages/opentelemetry-core/src/context/propagation/composite.ts @@ -17,7 +17,7 @@ import { Context, GetterFunction, - HttpTextFormat, + HttpTextPropagator, Logger, SetterFunction, } from '@opentelemetry/api'; @@ -25,8 +25,8 @@ import { NoopLogger } from '../../common/NoopLogger'; import { CompositePropagatorConfig } from './types'; /** Combines multiple propagators into a single propagator. */ -export class CompositePropagator implements HttpTextFormat { - private readonly _propagators: HttpTextFormat[]; +export class CompositePropagator implements HttpTextPropagator { + private readonly _propagators: HttpTextPropagator[]; private readonly _logger: Logger; /** diff --git a/packages/opentelemetry-core/src/context/propagation/types.ts b/packages/opentelemetry-core/src/context/propagation/types.ts index ff4a95a4f4..7e32712b8c 100644 --- a/packages/opentelemetry-core/src/context/propagation/types.ts +++ b/packages/opentelemetry-core/src/context/propagation/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { HttpTextFormat, Logger } from '@opentelemetry/api'; +import { HttpTextPropagator, Logger } from '@opentelemetry/api'; /** Configuration object for composite propagator */ export interface CompositePropagatorConfig { @@ -23,7 +23,7 @@ export interface CompositePropagatorConfig { * list order. If a propagator later in the list writes the same context * key as a propagator earlier in the list, the later on will "win". */ - propagators?: HttpTextFormat[]; + propagators?: HttpTextPropagator[]; /** Instance of logger */ logger?: Logger; diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts index 7fb711d43a..60b8b04f92 100644 --- a/packages/opentelemetry-core/src/index.ts +++ b/packages/opentelemetry-core/src/index.ts @@ -20,7 +20,7 @@ export * from './common/time'; export * from './common/types'; export * from './version'; export * from './context/context'; -export * from './context/propagation/B3Format'; +export * from './context/propagation/B3Propagator'; export * from './context/propagation/composite'; export * from './context/propagation/HttpTraceContext'; export * from './context/propagation/types'; diff --git a/packages/opentelemetry-core/test/context/B3Format.test.ts b/packages/opentelemetry-core/test/context/B3Propagator.test.ts similarity index 89% rename from packages/opentelemetry-core/test/context/B3Format.test.ts rename to packages/opentelemetry-core/test/context/B3Propagator.test.ts index df244b1f9c..6cf4e85d02 100644 --- a/packages/opentelemetry-core/test/context/B3Format.test.ts +++ b/packages/opentelemetry-core/test/context/B3Propagator.test.ts @@ -27,15 +27,15 @@ import { setExtractedSpanContext, } from '../../src/context/context'; import { - B3Format, + B3Propagator, X_B3_SAMPLED, X_B3_SPAN_ID, X_B3_TRACE_ID, -} from '../../src/context/propagation/B3Format'; +} from '../../src/context/propagation/B3Propagator'; import { TraceState } from '../../src/trace/TraceState'; -describe('B3Format', () => { - const b3Format = new B3Format(); +describe('B3Propagator', () => { + const b3Propagator = new B3Propagator(); let carrier: { [key: string]: unknown }; beforeEach(() => { @@ -50,7 +50,7 @@ describe('B3Format', () => { traceFlags: TraceFlags.SAMPLED, }; - b3Format.inject( + b3Propagator.inject( setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext), carrier, defaultSetter @@ -72,7 +72,7 @@ describe('B3Format', () => { isRemote: false, }; - b3Format.inject( + b3Propagator.inject( setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext), carrier, defaultSetter @@ -91,7 +91,7 @@ describe('B3Format', () => { spanId: '', traceFlags: TraceFlags.NONE, }; - b3Format.inject( + b3Propagator.inject( setExtractedSpanContext(Context.ROOT_CONTEXT, emptySpanContext), carrier, defaultSetter @@ -106,7 +106,7 @@ describe('B3Format', () => { carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c'; carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; const extractedSpanContext = getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ); assert.deepStrictEqual(extractedSpanContext, { @@ -122,7 +122,7 @@ describe('B3Format', () => { carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; carrier[X_B3_SAMPLED] = '1'; const extractedSpanContext = getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ); assert.deepStrictEqual(extractedSpanContext, { @@ -138,7 +138,7 @@ describe('B3Format', () => { carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; carrier[X_B3_SAMPLED] = true; const extractedSpanContext = getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ); assert.deepStrictEqual(extractedSpanContext, { @@ -154,7 +154,7 @@ describe('B3Format', () => { carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; carrier[X_B3_SAMPLED] = false; const extractedSpanContext = getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ); assert.deepStrictEqual(extractedSpanContext, { @@ -170,7 +170,7 @@ describe('B3Format', () => { carrier[X_B3_SPAN_ID] = undefined; assert.deepStrictEqual( getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ), undefined ); @@ -181,7 +181,7 @@ describe('B3Format', () => { carrier[X_B3_SPAN_ID] = undefined; assert.deepStrictEqual( getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ), undefined ); @@ -190,7 +190,7 @@ describe('B3Format', () => { it('returns undefined if b3 header is missing', () => { assert.deepStrictEqual( getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ), undefined ); @@ -200,7 +200,7 @@ describe('B3Format', () => { carrier[X_B3_TRACE_ID] = 'invalid!'; assert.deepStrictEqual( getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ), undefined ); @@ -211,7 +211,7 @@ describe('B3Format', () => { carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; carrier[X_B3_SAMPLED] = '01'; const extractedSpanContext = getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -262,7 +262,7 @@ describe('B3Format', () => { carrier[X_B3_TRACE_ID] = testCases[testCase]; const extractedSpanContext = getExtractedSpanContext( - b3Format.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) + b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) ); assert.deepStrictEqual(extractedSpanContext, undefined, testCase); }); diff --git a/packages/opentelemetry-core/test/context/composite.test.ts b/packages/opentelemetry-core/test/context/composite.test.ts index 396f566558..a97b29980a 100644 --- a/packages/opentelemetry-core/test/context/composite.test.ts +++ b/packages/opentelemetry-core/test/context/composite.test.ts @@ -17,7 +17,7 @@ import { defaultGetter, defaultSetter, - HttpTextFormat, + HttpTextPropagator, SpanContext, } from '@opentelemetry/api'; import { Context } from '@opentelemetry/scope-base'; @@ -33,11 +33,11 @@ import { setExtractedSpanContext, } from '../../src/context/context'; import { - B3Format, + B3Propagator, X_B3_SAMPLED, X_B3_SPAN_ID, X_B3_TRACE_ID, -} from '../../src/context/propagation/B3Format'; +} from '../../src/context/propagation/B3Propagator'; import { TRACE_PARENT_HEADER, TRACE_STATE_HEADER, @@ -74,7 +74,7 @@ describe('Composite Propagator', () => { it('should inject context using all configured propagators', () => { const composite = new CompositePropagator({ - propagators: [new B3Format(), new HttpTraceContext()], + propagators: [new B3Propagator(), new HttpTraceContext()], }); composite.inject(ctxWithSpanContext, carrier, defaultSetter); @@ -116,7 +116,7 @@ describe('Composite Propagator', () => { it('should extract context using all configured propagators', () => { const composite = new CompositePropagator({ - propagators: [new B3Format(), new HttpTraceContext()], + propagators: [new B3Propagator(), new HttpTraceContext()], }); const spanContext = getExtractedSpanContext( composite.extract(Context.ROOT_CONTEXT, carrier, defaultGetter) @@ -154,7 +154,7 @@ describe('Composite Propagator', () => { }); }); -class ThrowingPropagator implements HttpTextFormat { +class ThrowingPropagator implements HttpTextPropagator { inject(context: Context, carrier: unknown) { throw new Error('this propagator throws'); } diff --git a/packages/opentelemetry-node/test/registration.test.ts b/packages/opentelemetry-node/test/registration.test.ts index 378abf1be9..ae20487bb1 100644 --- a/packages/opentelemetry-node/test/registration.test.ts +++ b/packages/opentelemetry-node/test/registration.test.ts @@ -16,7 +16,7 @@ import { context, - NoopHttpTextFormat, + NoopHttpTextPropagator, NoopTracerProvider, propagation, trace, @@ -30,7 +30,7 @@ import { NodeTracerProvider } from '../src'; describe('API registration', () => { beforeEach(() => { context.setGlobalContextManager(new NoopScopeManager()); - propagation.setGlobalPropagator(new NoopHttpTextFormat()); + propagation.setGlobalPropagator(new NoopHttpTextPropagator()); trace.setGlobalTracerProvider(new NoopTracerProvider()); }); @@ -47,7 +47,7 @@ describe('API registration', () => { const tracerProvider = new NodeTracerProvider(); const contextManager = new NoopScopeManager(); - const propagator = new NoopHttpTextFormat(); + const propagator = new NoopHttpTextPropagator(); tracerProvider.register({ contextManager, @@ -78,7 +78,7 @@ describe('API registration', () => { propagator: null, }); - assert.ok(propagation['_propagator'] instanceof NoopHttpTextFormat); + assert.ok(propagation['_propagator'] instanceof NoopHttpTextPropagator); assert.ok(context['_scopeManager'] instanceof AsyncHooksScopeManager); assert.ok(trace['_tracerProvider'] === tracerProvider); diff --git a/packages/opentelemetry-plugin-http/src/enums/Format.ts b/packages/opentelemetry-plugin-http/src/enums/Format.ts deleted file mode 100644 index c67b1c54da..0000000000 --- a/packages/opentelemetry-plugin-http/src/enums/Format.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export enum Format { - HTTP = 'HttpTraceContext', -} diff --git a/packages/opentelemetry-plugin-http/src/index.ts b/packages/opentelemetry-plugin-http/src/index.ts index 02a2b7c309..6d56e7a712 100644 --- a/packages/opentelemetry-plugin-http/src/index.ts +++ b/packages/opentelemetry-plugin-http/src/index.ts @@ -18,4 +18,3 @@ export * from './http'; export * from './types'; export * from './utils'; export * from './enums/AttributeNames'; -export * from './enums/Format'; diff --git a/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts b/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts index 14c61e5392..02c85aa92e 100644 --- a/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts +++ b/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Context, HttpTextFormat, TraceFlags } from '@opentelemetry/api'; +import { Context, HttpTextPropagator, TraceFlags } from '@opentelemetry/api'; import { setExtractedSpanContext, getParentSpanContext, } from '@opentelemetry/core'; import * as http from 'http'; -export class DummyPropagation implements HttpTextFormat { +export class DummyPropagation implements HttpTextPropagator { static TRACE_CONTEXT_KEY = 'x-dummy-trace-id'; static SPAN_CONTEXT_KEY = 'x-dummy-span-id'; extract(context: Context, carrier: http.OutgoingHttpHeaders) { diff --git a/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts b/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts index 14c61e5392..02c85aa92e 100644 --- a/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts +++ b/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Context, HttpTextFormat, TraceFlags } from '@opentelemetry/api'; +import { Context, HttpTextPropagator, TraceFlags } from '@opentelemetry/api'; import { setExtractedSpanContext, getParentSpanContext, } from '@opentelemetry/core'; import * as http from 'http'; -export class DummyPropagation implements HttpTextFormat { +export class DummyPropagation implements HttpTextPropagator { static TRACE_CONTEXT_KEY = 'x-dummy-trace-id'; static SPAN_CONTEXT_KEY = 'x-dummy-span-id'; extract(context: Context, carrier: http.OutgoingHttpHeaders) { diff --git a/packages/opentelemetry-plugin-xml-http-request/src/enums/Format.ts b/packages/opentelemetry-plugin-xml-http-request/src/enums/Format.ts deleted file mode 100644 index c67b1c54da..0000000000 --- a/packages/opentelemetry-plugin-xml-http-request/src/enums/Format.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export enum Format { - HTTP = 'HttpTraceContext', -} diff --git a/packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts b/packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts index abc1bc61ac..d95e7fdc4e 100644 --- a/packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts +++ b/packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts @@ -15,7 +15,7 @@ */ import * as types from '@opentelemetry/api'; import { - B3Format, + B3Propagator, LogLevel, otperformance as performance, X_B3_SAMPLED, @@ -109,7 +109,7 @@ describe('xhr', () => { }); before(() => { - types.propagation.setGlobalPropagator(new B3Format()); + types.propagation.setGlobalPropagator(new B3Propagator()); }); describe('when request is successful', () => { diff --git a/packages/opentelemetry-propagator-jaeger/README.md b/packages/opentelemetry-propagator-jaeger/README.md index 90203cd9d1..ba02c5c683 100644 --- a/packages/opentelemetry-propagator-jaeger/README.md +++ b/packages/opentelemetry-propagator-jaeger/README.md @@ -26,10 +26,10 @@ Format: Example of usage: ```javascript const { NodeTracerProvider } = require('@opentelemetry/node'); -const { JaegerHttpTraceFormat } = require('@opentelemetry/propagator-jaeger'); +const { JaegerHttpTracePropagator } = require('@opentelemetry/propagator-jaeger'); const provider = new NodeTracerProvider({ - httpTextFormat: new JaegerHttpTraceFormat() + HttpTextPropagator: new JaegerHttpTracePropagator() }); ``` diff --git a/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTraceFormat.ts b/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts similarity index 97% rename from packages/opentelemetry-propagator-jaeger/src/JaegerHttpTraceFormat.ts rename to packages/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts index aec84b7aa0..13901fc8a1 100644 --- a/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTraceFormat.ts +++ b/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts @@ -16,7 +16,7 @@ import { Context, - HttpTextFormat, + HttpTextPropagator, SpanContext, TraceFlags, SetterFunction, @@ -44,7 +44,7 @@ export const UBER_TRACE_ID_HEADER = 'uber-trace-id'; * One byte bitmap, as two hex digits. * Inspired by jaeger-client-node project. */ -export class JaegerHttpTraceFormat implements HttpTextFormat { +export class JaegerHttpTracePropagator implements HttpTextPropagator { private readonly _jaegerTraceHeader: string; /** diff --git a/packages/opentelemetry-propagator-jaeger/src/index.ts b/packages/opentelemetry-propagator-jaeger/src/index.ts index 620c254f23..943458d837 100644 --- a/packages/opentelemetry-propagator-jaeger/src/index.ts +++ b/packages/opentelemetry-propagator-jaeger/src/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './JaegerHttpTraceFormat'; +export * from './JaegerHttpTracePropagator'; diff --git a/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTraceFormat.test.ts b/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts similarity index 88% rename from packages/opentelemetry-propagator-jaeger/test/JaegerHttpTraceFormat.test.ts rename to packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts index fb56229ad4..71f7292a12 100644 --- a/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTraceFormat.test.ts +++ b/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts @@ -27,14 +27,14 @@ import { } from '@opentelemetry/core'; import * as assert from 'assert'; import { - JaegerHttpTraceFormat, + JaegerHttpTracePropagator, UBER_TRACE_ID_HEADER, -} from '../src/JaegerHttpTraceFormat'; +} from '../src/JaegerHttpTracePropagator'; -describe('JaegerHttpTraceFormat', () => { - const jaegerHttpTraceFormat = new JaegerHttpTraceFormat(); +describe('JaegerHttpTracePropagator', () => { + const jaegerHttpTracePropagator = new JaegerHttpTracePropagator(); const customHeader = 'new-header'; - const customJaegerHttpTraceFormat = new JaegerHttpTraceFormat(customHeader); + const customJaegerHttpTracePropagator = new JaegerHttpTracePropagator(customHeader); let carrier: { [key: string]: unknown }; beforeEach(() => { @@ -49,7 +49,7 @@ describe('JaegerHttpTraceFormat', () => { traceFlags: TraceFlags.SAMPLED, }; - jaegerHttpTraceFormat.inject( + jaegerHttpTracePropagator.inject( setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext), carrier, defaultSetter @@ -67,7 +67,7 @@ describe('JaegerHttpTraceFormat', () => { traceFlags: TraceFlags.SAMPLED, }; - customJaegerHttpTraceFormat.inject( + customJaegerHttpTracePropagator.inject( setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext), carrier, defaultSetter @@ -84,7 +84,7 @@ describe('JaegerHttpTraceFormat', () => { carrier[UBER_TRACE_ID_HEADER] = 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01'; const extractedSpanContext = getExtractedSpanContext( - jaegerHttpTraceFormat.extract( + jaegerHttpTracePropagator.extract( Context.ROOT_CONTEXT, carrier, defaultGetter @@ -103,7 +103,7 @@ describe('JaegerHttpTraceFormat', () => { carrier[UBER_TRACE_ID_HEADER] = '9c41e35aeb6d1272:45fd2a9709dadcf1:a13699e3fb724f40:1'; const extractedSpanContext = getExtractedSpanContext( - jaegerHttpTraceFormat.extract( + jaegerHttpTracePropagator.extract( Context.ROOT_CONTEXT, carrier, defaultGetter @@ -122,7 +122,7 @@ describe('JaegerHttpTraceFormat', () => { carrier[UBER_TRACE_ID_HEADER] = 'ac1f3dc3c2c0b06e%3A5ac292c4a11a163e%3Ac086aaa825821068%3A1'; const extractedSpanContext = getExtractedSpanContext( - jaegerHttpTraceFormat.extract( + jaegerHttpTracePropagator.extract( Context.ROOT_CONTEXT, carrier, defaultGetter @@ -141,7 +141,7 @@ describe('JaegerHttpTraceFormat', () => { carrier[customHeader] = 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01'; const extractedSpanContext = getExtractedSpanContext( - customJaegerHttpTraceFormat.extract( + customJaegerHttpTracePropagator.extract( Context.ROOT_CONTEXT, carrier, defaultGetter @@ -159,7 +159,7 @@ describe('JaegerHttpTraceFormat', () => { it('returns undefined if UBER_TRACE_ID_HEADER header is missing', () => { assert.deepStrictEqual( getExtractedSpanContext( - jaegerHttpTraceFormat.extract( + jaegerHttpTracePropagator.extract( Context.ROOT_CONTEXT, carrier, defaultGetter @@ -173,7 +173,7 @@ describe('JaegerHttpTraceFormat', () => { carrier[UBER_TRACE_ID_HEADER] = 'invalid!'; assert.deepStrictEqual( getExtractedSpanContext( - jaegerHttpTraceFormat.extract( + jaegerHttpTracePropagator.extract( Context.ROOT_CONTEXT, carrier, defaultGetter diff --git a/packages/opentelemetry-tracing/src/types.ts b/packages/opentelemetry-tracing/src/types.ts index 3d4ccb1123..e37bd136e9 100644 --- a/packages/opentelemetry-tracing/src/types.ts +++ b/packages/opentelemetry-tracing/src/types.ts @@ -16,7 +16,7 @@ import { Attributes, - HttpTextFormat, + HttpTextPropagator, Logger, Sampler, } from '@opentelemetry/api'; @@ -61,7 +61,7 @@ export interface TracerConfig { */ export interface SDKRegistrationConfig { /** Propagator to register as the global propagator */ - propagator?: HttpTextFormat | null; + propagator?: HttpTextPropagator | null; /** Context manager to register as the global context manager */ contextManager?: ScopeManager | null; diff --git a/packages/opentelemetry-web/test/registration.test.ts b/packages/opentelemetry-web/test/registration.test.ts index ea1e4a3ef1..d021df9d3d 100644 --- a/packages/opentelemetry-web/test/registration.test.ts +++ b/packages/opentelemetry-web/test/registration.test.ts @@ -16,7 +16,7 @@ import { context, - NoopHttpTextFormat, + NoopHttpTextPropagator, NoopTracerProvider, propagation, trace, @@ -29,7 +29,7 @@ import { WebTracerProvider, StackScopeManager } from '../src'; describe('API registration', () => { beforeEach(() => { context.setGlobalContextManager(new NoopScopeManager()); - propagation.setGlobalPropagator(new NoopHttpTextFormat()); + propagation.setGlobalPropagator(new NoopHttpTextPropagator()); trace.setGlobalTracerProvider(new NoopTracerProvider()); }); @@ -46,7 +46,7 @@ describe('API registration', () => { const tracerProvider = new WebTracerProvider(); const contextManager = new NoopScopeManager(); - const propagator = new NoopHttpTextFormat(); + const propagator = new NoopHttpTextPropagator(); tracerProvider.register({ contextManager, @@ -77,7 +77,7 @@ describe('API registration', () => { propagator: null, }); - assert.ok(propagation['_propagator'] instanceof NoopHttpTextFormat); + assert.ok(propagation['_propagator'] instanceof NoopHttpTextPropagator); assert.ok(context['_scopeManager'] instanceof StackScopeManager); assert.ok(trace['_tracerProvider'] === tracerProvider); From 7ae7cb02c76fc47f750e11fcf8d65a8250719331 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 12 Mar 2020 10:15:57 -0400 Subject: [PATCH 2/5] chore: lint --- packages/opentelemetry-api/src/api/propagation.ts | 4 +++- .../test/JaegerHttpTracePropagator.test.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/opentelemetry-api/src/api/propagation.ts b/packages/opentelemetry-api/src/api/propagation.ts index 9df2d6532e..5155bf03ce 100644 --- a/packages/opentelemetry-api/src/api/propagation.ts +++ b/packages/opentelemetry-api/src/api/propagation.ts @@ -45,7 +45,9 @@ export class PropagationAPI { /** * Set the current propagator. Returns the initialized propagator */ - public setGlobalPropagator(propagator: HttpTextPropagator): HttpTextPropagator { + public setGlobalPropagator( + propagator: HttpTextPropagator + ): HttpTextPropagator { this._propagator = propagator; return propagator; } diff --git a/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts b/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts index 71f7292a12..d2fa0b95e8 100644 --- a/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts +++ b/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts @@ -34,7 +34,9 @@ import { describe('JaegerHttpTracePropagator', () => { const jaegerHttpTracePropagator = new JaegerHttpTracePropagator(); const customHeader = 'new-header'; - const customJaegerHttpTracePropagator = new JaegerHttpTracePropagator(customHeader); + const customJaegerHttpTracePropagator = new JaegerHttpTracePropagator( + customHeader + ); let carrier: { [key: string]: unknown }; beforeEach(() => { From 64696ab3fc442cd33a4b67214817556c4451fb27 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 12 Mar 2020 16:00:49 -0400 Subject: [PATCH 3/5] chore: last few formatter renames --- packages/opentelemetry-api/src/api/propagation.ts | 4 ++-- .../src/context/propagation/NoopHttpTextPropagator.ts | 2 +- packages/opentelemetry-api/src/trace/NoopTracer.ts | 8 +------- packages/opentelemetry-api/test/api/api.test.ts | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/opentelemetry-api/src/api/propagation.ts b/packages/opentelemetry-api/src/api/propagation.ts index 5155bf03ce..7d254659ce 100644 --- a/packages/opentelemetry-api/src/api/propagation.ts +++ b/packages/opentelemetry-api/src/api/propagation.ts @@ -17,7 +17,7 @@ import { Context } from '@opentelemetry/scope-base'; import { defaultGetter, GetterFunction } from '../context/propagation/getter'; import { HttpTextPropagator } from '../context/propagation/HttpTextPropagator'; -import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextPropagator'; +import { NOOP_HTTP_TEXT_PROPAGATOR } from '../context/propagation/NoopHttpTextPropagator'; import { defaultSetter, SetterFunction } from '../context/propagation/setter'; import { ContextAPI } from './context'; @@ -28,7 +28,7 @@ const contextApi = ContextAPI.getInstance(); */ export class PropagationAPI { private static _instance?: PropagationAPI; - private _propagator: HttpTextPropagator = NOOP_HTTP_TEXT_FORMAT; + private _propagator: HttpTextPropagator = NOOP_HTTP_TEXT_PROPAGATOR; /** Empty private constructor prevents end users from constructing a new instance of the API */ private constructor() {} diff --git a/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts b/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts index 7243c7314f..9d4dc70916 100644 --- a/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts +++ b/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts @@ -29,4 +29,4 @@ export class NoopHttpTextPropagator implements HttpTextPropagator { } } -export const NOOP_HTTP_TEXT_FORMAT = new NoopHttpTextPropagator(); +export const NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); diff --git a/packages/opentelemetry-api/src/trace/NoopTracer.ts b/packages/opentelemetry-api/src/trace/NoopTracer.ts index 0df1917b41..ed4c63f834 100644 --- a/packages/opentelemetry-api/src/trace/NoopTracer.ts +++ b/packages/opentelemetry-api/src/trace/NoopTracer.ts @@ -14,8 +14,7 @@ * limitations under the License. */ -import { HttpTextPropagator, Span, SpanOptions, Tracer } from '..'; -import { NOOP_HTTP_TEXT_FORMAT } from '../context/propagation/NoopHttpTextPropagator'; +import { Span, SpanOptions, Tracer } from '..'; import { NOOP_SPAN } from './NoopSpan'; /** @@ -41,11 +40,6 @@ export class NoopTracer implements Tracer { bind(target: T, span?: Span): T { return target; } - - // By default does nothing - getHttpTextPropagator(): HttpTextPropagator { - return NOOP_HTTP_TEXT_FORMAT; - } } export const NOOP_TRACER = new NoopTracer(); diff --git a/packages/opentelemetry-api/test/api/api.test.ts b/packages/opentelemetry-api/test/api/api.test.ts index d68a85f98b..68a4dafb84 100644 --- a/packages/opentelemetry-api/test/api/api.test.ts +++ b/packages/opentelemetry-api/test/api/api.test.ts @@ -29,7 +29,6 @@ describe('API', () => { 'getCurrentSpan', 'startSpan', 'withSpan', - 'getHttpTextPropagator', ]; it('should expose a tracer provider via getTracerProvider', () => { From 68f74c5eb57cf50717a38b4c91c9757c57cd8880 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 12 Mar 2020 16:08:43 -0400 Subject: [PATCH 4/5] chore: remove test of removed function --- .../test/noop-implementations/noop-tracer.test.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts index 48720d5845..096a2e8c3e 100644 --- a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts +++ b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts @@ -37,14 +37,6 @@ describe('NoopTracer', () => { ); assert.deepStrictEqual(tracer.getCurrentSpan(), NOOP_SPAN); - const HttpTextPropagator = tracer.getHttpTextPropagator(); - assert.ok(HttpTextPropagator); - - HttpTextPropagator.inject(Context.ROOT_CONTEXT, {}, defaultSetter); - assert.deepStrictEqual( - HttpTextPropagator.extract(Context.ROOT_CONTEXT, {}, defaultGetter), - Context.ROOT_CONTEXT - ); }); it('should not crash when .withSpan()', done => { From 85b5463e0f34039b0556664292539ddca1cfea31 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 12 Mar 2020 16:51:56 -0400 Subject: [PATCH 5/5] chore: remove unused imports --- packages/opentelemetry-api/test/api/api.test.ts | 6 +----- .../test/noop-implementations/noop-tracer.test.ts | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/opentelemetry-api/test/api/api.test.ts b/packages/opentelemetry-api/test/api/api.test.ts index 68a4dafb84..e9994038cc 100644 --- a/packages/opentelemetry-api/test/api/api.test.ts +++ b/packages/opentelemetry-api/test/api/api.test.ts @@ -25,11 +25,7 @@ import api, { } from '../../src'; describe('API', () => { - const functions = [ - 'getCurrentSpan', - 'startSpan', - 'withSpan', - ]; + const functions = ['getCurrentSpan', 'startSpan', 'withSpan']; it('should expose a tracer provider via getTracerProvider', () => { const tracer = api.trace.getTracerProvider(); diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts index 096a2e8c3e..e49d0c0388 100644 --- a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts +++ b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts @@ -14,11 +14,8 @@ * limitations under the License. */ -import { Context } from '@opentelemetry/scope-base'; import * as assert from 'assert'; import { NoopTracer, NOOP_SPAN, SpanKind } from '../../src'; -import { defaultGetter } from '../../src/context/propagation/getter'; -import { defaultSetter } from '../../src/context/propagation/setter'; describe('NoopTracer', () => { it('should not crash', () => {