Skip to content

Commit

Permalink
Rename formatter to propagator (open-telemetry#851)
Browse files Browse the repository at this point in the history
* chore: rename formatter to propagator

* chore: lint

* chore: last few formatter renames

* chore: remove test of removed function

* chore: remove unused imports
  • Loading branch information
dyladan authored Mar 13, 2020
1 parent 7bd62b7 commit 4a7e3e2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {
Context,
HttpTextFormat,
HttpTextPropagator,
SpanContext,
TraceFlags,
SetterFunction,
Expand Down Expand Up @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './JaegerHttpTraceFormat';
export * from './JaegerHttpTracePropagator';
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ 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(() => {
Expand All @@ -49,7 +51,7 @@ describe('JaegerHttpTraceFormat', () => {
traceFlags: TraceFlags.SAMPLED,
};

jaegerHttpTraceFormat.inject(
jaegerHttpTracePropagator.inject(
setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
carrier,
defaultSetter
Expand All @@ -67,7 +69,7 @@ describe('JaegerHttpTraceFormat', () => {
traceFlags: TraceFlags.SAMPLED,
};

customJaegerHttpTraceFormat.inject(
customJaegerHttpTracePropagator.inject(
setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
carrier,
defaultSetter
Expand All @@ -84,7 +86,7 @@ describe('JaegerHttpTraceFormat', () => {
carrier[UBER_TRACE_ID_HEADER] =
'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01';
const extractedSpanContext = getExtractedSpanContext(
jaegerHttpTraceFormat.extract(
jaegerHttpTracePropagator.extract(
Context.ROOT_CONTEXT,
carrier,
defaultGetter
Expand All @@ -103,7 +105,7 @@ describe('JaegerHttpTraceFormat', () => {
carrier[UBER_TRACE_ID_HEADER] =
'9c41e35aeb6d1272:45fd2a9709dadcf1:a13699e3fb724f40:1';
const extractedSpanContext = getExtractedSpanContext(
jaegerHttpTraceFormat.extract(
jaegerHttpTracePropagator.extract(
Context.ROOT_CONTEXT,
carrier,
defaultGetter
Expand All @@ -122,7 +124,7 @@ describe('JaegerHttpTraceFormat', () => {
carrier[UBER_TRACE_ID_HEADER] =
'ac1f3dc3c2c0b06e%3A5ac292c4a11a163e%3Ac086aaa825821068%3A1';
const extractedSpanContext = getExtractedSpanContext(
jaegerHttpTraceFormat.extract(
jaegerHttpTracePropagator.extract(
Context.ROOT_CONTEXT,
carrier,
defaultGetter
Expand All @@ -141,7 +143,7 @@ describe('JaegerHttpTraceFormat', () => {
carrier[customHeader] =
'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01';
const extractedSpanContext = getExtractedSpanContext(
customJaegerHttpTraceFormat.extract(
customJaegerHttpTracePropagator.extract(
Context.ROOT_CONTEXT,
carrier,
defaultGetter
Expand All @@ -159,7 +161,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
Expand All @@ -173,7 +175,7 @@ describe('JaegerHttpTraceFormat', () => {
carrier[UBER_TRACE_ID_HEADER] = 'invalid!';
assert.deepStrictEqual(
getExtractedSpanContext(
jaegerHttpTraceFormat.extract(
jaegerHttpTracePropagator.extract(
Context.ROOT_CONTEXT,
carrier,
defaultGetter
Expand Down

0 comments on commit 4a7e3e2

Please sign in to comment.