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,