Skip to content

Commit

Permalink
fix!: rename HttpTraceContextPropagator to TraceContextTextMapPropagator
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Aug 26, 2021
1 parent 30733df commit 492107a
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions benchmark/propagator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const setups = [
}
},
{
name: 'HttpTraceContextPropagator',
propagator: new opentelemetry.HttpTraceContextPropagator(),
name: 'TraceContextTextMapPropagator',
propagator: new opentelemetry.TraceContextTextMapPropagator(),
injectCarrier: {},
extractCarrier: {
traceparent: '00-d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92-00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const axios = require("axios");
const { HttpTraceContextPropagator } = require("@opentelemetry/core");
const { TraceContextTextMapPropagator } = require("@opentelemetry/core");
const { BasicTracerProvider } = require("@opentelemetry/sdk-trace-base");
const { context, propagation, trace, ROOT_CONTEXT } = require("@opentelemetry/api");
const {
Expand All @@ -8,7 +8,7 @@ const {
const bodyParser = require("body-parser");

// set global propagator
propagation.setGlobalPropagator(new HttpTraceContextPropagator());
propagation.setGlobalPropagator(new TraceContextTextMapPropagator());

// set global context manager
context.setGlobalContextManager(new AsyncHooksContextManager());
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This package provides default implementations of the OpenTelemetry API for trace
- [OpenTelemetry Core](#opentelemetry-core)
- [Built-in Implementations](#built-in-implementations)
- [Built-in Propagators](#built-in-propagators)
- [HttpTraceContextPropagator Propagator](#httptracecontext-propagator)
- [TraceContextTextMapPropagator Propagator](#httptracecontext-propagator)
- [Composite Propagator](#composite-propagator)
- [Baggage Propagator](#baggage-propagator)
- [Built-in Sampler](#built-in-sampler)
Expand All @@ -25,16 +25,16 @@ This package provides default implementations of the OpenTelemetry API for trace

### Built-in Propagators

#### HttpTraceContextPropagator Propagator
#### TraceContextTextMapPropagator Propagator

OpenTelemetry provides a text-based approach to propagate context to remote services using the [W3C Trace Context](https://www.w3.org/TR/trace-context/) HTTP headers.

```js
const api = require("@opentelemetry/api");
const { HttpTraceContextPropagator } = require("@opentelemetry/core");
const { TraceContextTextMapPropagator } = require("@opentelemetry/core");

/* Set Global Propagator */
api.propagation.setGlobalPropagator(new HttpTraceContextPropagator());
api.propagation.setGlobalPropagator(new TraceContextTextMapPropagator());
```

#### Composite Propagator
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export * from './version';
export * as baggageUtils from './baggage/utils';
export * from './platform';
export * from './propagation/composite';
export * from './trace/HttpTraceContextPropagator';
export * from './trace/TraceContextTextMapPropagator';
export * from './trace/IdGenerator';
export * from './trace/rpc-metadata';
export * from './trace/sampler/AlwaysOffSampler';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function parseTraceParent(traceParent: string): SpanContext | null {
* Based on the Trace Context specification:
* https://www.w3.org/TR/trace-context/
*/
export class HttpTraceContextPropagator implements TextMapPropagator {
export class TraceContextTextMapPropagator implements TextMapPropagator {
inject(context: Context, carrier: unknown, setter: TextMapSetter): void {
const spanContext = trace.getSpanContext(context);
if (
Expand Down
12 changes: 6 additions & 6 deletions packages/opentelemetry-core/test/propagation/composite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import { Context, ROOT_CONTEXT } from '@opentelemetry/api';
import * as assert from 'assert';
import {
CompositePropagator,
HttpTraceContextPropagator,
TraceContextTextMapPropagator,
RandomIdGenerator,
} from '../../src';
import {
TRACE_PARENT_HEADER,
TRACE_STATE_HEADER,
} from '../../src/trace/HttpTraceContextPropagator';
} from '../../src/trace/TraceContextTextMapPropagator';
import { TraceState } from '../../src/trace/TraceState';

class DummyPropagator implements TextMapPropagator {
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Composite Propagator', () => {

it('should inject context using all configured propagators', () => {
const composite = new CompositePropagator({
propagators: [new DummyPropagator(), new HttpTraceContextPropagator()],
propagators: [new DummyPropagator(), new TraceContextTextMapPropagator()],
});
composite.inject(ctxWithSpanContext, carrier, defaultTextMapSetter);

Expand All @@ -94,7 +94,7 @@ describe('Composite Propagator', () => {
const composite = new CompositePropagator({
propagators: [
new ThrowingPropagator(),
new HttpTraceContextPropagator(),
new TraceContextTextMapPropagator(),
],
});
composite.inject(ctxWithSpanContext, carrier, defaultTextMapSetter);
Expand All @@ -119,7 +119,7 @@ describe('Composite Propagator', () => {

it('should extract context using all configured propagators', () => {
const composite = new CompositePropagator({
propagators: [new DummyPropagator(), new HttpTraceContextPropagator()],
propagators: [new DummyPropagator(), new TraceContextTextMapPropagator()],
});
const spanContext = trace.getSpanContext(
composite.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
Expand All @@ -140,7 +140,7 @@ describe('Composite Propagator', () => {
const composite = new CompositePropagator({
propagators: [
new ThrowingPropagator(),
new HttpTraceContextPropagator(),
new TraceContextTextMapPropagator(),
],
});
const spanContext = trace.getSpanContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import {
} from '@opentelemetry/api';
import * as assert from 'assert';
import {
HttpTraceContextPropagator,
TraceContextTextMapPropagator,
TRACE_PARENT_HEADER,
TRACE_STATE_HEADER,
} from '../../src/trace/HttpTraceContextPropagator';
} from '../../src/trace/TraceContextTextMapPropagator';
import { suppressTracing } from '../../src/trace/suppress-tracing';
import { TraceState } from '../../src/trace/TraceState';

describe('HttpTraceContextPropagator', () => {
const httpTraceContext = new HttpTraceContextPropagator();
describe('TraceContextTextMapPropagator', () => {
const httpTraceContext = new TraceContextTextMapPropagator();
let carrier: { [key: string]: unknown };

beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-instrumentation-grpc/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
SpanKind,
propagation, trace,
} from '@opentelemetry/api';
import { HttpTraceContextPropagator } from '@opentelemetry/core';
import { TraceContextTextMapPropagator } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import { ContextManager } from '@opentelemetry/api';
Expand Down Expand Up @@ -386,7 +386,7 @@ export const runTests = (
let contextManager: ContextManager;

before(() => {
propagation.setGlobalPropagator(new HttpTraceContextPropagator());
propagation.setGlobalPropagator(new TraceContextTextMapPropagator());
});

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
import {
CompositePropagator,
HttpBaggagePropagator,
HttpTraceContextPropagator,
TraceContextTextMapPropagator,
getEnv,
} from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';
Expand Down Expand Up @@ -57,7 +57,7 @@ export class BasicTracerProvider implements TracerProvider {
string,
PROPAGATOR_FACTORY
>([
['tracecontext', () => new HttpTraceContextPropagator()],
['tracecontext', () => new TraceContextTextMapPropagator()],
['baggage', () => new HttpBaggagePropagator()],
]);

Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-shim-opentracing/test/Shim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { SpanContextShim, SpanShim, TracerShim } from '../src/shim';
import {
CompositePropagator,
HttpBaggagePropagator,
HttpTraceContextPropagator,
TraceContextTextMapPropagator,
timeInputToHrTime,
} from '@opentelemetry/core';
import {
Expand All @@ -41,7 +41,7 @@ import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
describe('OpenTracing Shim', () => {
const compositePropagator = new CompositePropagator({
propagators: [
new HttpTraceContextPropagator(),
new TraceContextTextMapPropagator(),
new HttpBaggagePropagator(),
],
});
Expand Down

0 comments on commit 492107a

Please sign in to comment.