From 53682c025864762be1fb42fba2afe333d381cd49 Mon Sep 17 00:00:00 2001 From: Jakub Malinowski Date: Tue, 24 Nov 2020 15:59:30 +0100 Subject: [PATCH] fix: missing .fields() method in jaeger propagator --- .../src/JaegerHttpTracePropagator.ts | 4 ++++ .../test/JaegerHttpTracePropagator.test.ts | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/propagators/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts b/propagators/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts index 6cf29e4c72..9b3138eb63 100644 --- a/propagators/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts +++ b/propagators/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts @@ -80,6 +80,10 @@ export class JaegerHttpTracePropagator implements TextMapPropagator { return setExtractedSpanContext(context, spanContext); } + + fields(): string[] { + return [this._jaegerTraceHeader]; + } } /** diff --git a/propagators/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts b/propagators/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts index fae7c8fe82..29503ba4c2 100644 --- a/propagators/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts +++ b/propagators/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts @@ -172,6 +172,19 @@ describe('JaegerHttpTracePropagator', () => { }); }); + describe('.fields()', () => { + it('returns the default header if not customized', () => { + assert.deepStrictEqual(jaegerHttpTracePropagator.fields(), [ + 'uber-trace-id', + ]); + }); + it('returns the customized header if customized', () => { + assert.deepStrictEqual(customJaegerHttpTracePropagator.fields(), [ + customHeader, + ]); + }); + }); + it('should fail gracefully on bad responses from getter', () => { const ctx1 = jaegerHttpTracePropagator.extract( ROOT_CONTEXT,