Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd9c7ab

Browse files
authored
rename DistributedContext to CorrelationContext (open-telemetry#834)
1 parent 1b21464 commit fd9c7ab

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

packages/opentelemetry-api/src/distributed_context/DistributedContext.ts renamed to packages/opentelemetry-api/src/correlation_context/CorrelationContext.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
import { EntryValue } from './EntryValue';
1818

1919
/**
20-
* DistributedContext represents collection of entries. Each key of
21-
* DistributedContext is associated with exactly one value. DistributedContext
20+
* CorrelationContext represents collection of entries. Each key of
21+
* CorrelationContext is associated with exactly one value. CorrelationContext
2222
* is serializable, to facilitate propagating it not only inside the process
23-
* but also across process boundaries. DistributedContext is used to annotate
23+
* but also across process boundaries. CorrelationContext is used to annotate
2424
* telemetry with the name:value pair Entry. Those values can be used to add
2525
* dimension to the metric or additional contest properties to logs and traces.
2626
*/
27-
export interface DistributedContext {
27+
export interface CorrelationContext {
2828
[entryKey: string]: EntryValue;
2929
}

packages/opentelemetry-api/src/distributed_context/EntryValue.ts renamed to packages/opentelemetry-api/src/correlation_context/EntryValue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/**
1818
* {@link EntryValue} contains properties associated with a {@link
19-
* DistributedContext}.
19+
* CorrelationContext}.
2020
*/
2121
export interface EntryValue {
2222
/** `String` value of the `EntryValue`. */

packages/opentelemetry-api/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export * from './common/Logger';
1818
export * from './common/Time';
1919
export * from './context/propagation/carrier';
2020
export * from './context/propagation/HttpTextFormat';
21-
export * from './distributed_context/DistributedContext';
22-
export * from './distributed_context/EntryValue';
21+
export * from './correlation_context/CorrelationContext';
22+
export * from './correlation_context/EntryValue';
2323
export * from './metrics/BoundInstrument';
2424
export * from './metrics/Meter';
2525
export * from './metrics/MeterProvider';

packages/opentelemetry-api/src/metrics/BoundInstrument.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { DistributedContext } from '../distributed_context/DistributedContext';
17+
import { CorrelationContext } from '../correlation_context/CorrelationContext';
1818
import { SpanContext } from '../trace/span_context';
1919

2020
/** An Instrument for Counter Metric. */
@@ -31,15 +31,16 @@ export interface BoundMeasure {
3131
/**
3232
* Records the given value to this measure.
3333
* @param value the measurement to record.
34-
* @param distContext the distContext associated with the measurements.
34+
* @param correlationContext the correlationContext associated with the
35+
* measurements.
3536
* @param spanContext the {@link SpanContext} that identifies the {@link Span}
3637
* for which the measurements are associated with.
3738
*/
3839
record(value: number): void;
39-
record(value: number, distContext: DistributedContext): void;
40+
record(value: number, correlationContext: CorrelationContext): void;
4041
record(
4142
value: number,
42-
distContext: DistributedContext,
43+
correlationContext: CorrelationContext,
4344
spanContext: SpanContext
4445
): void;
4546
}

packages/opentelemetry-api/src/metrics/Metric.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { DistributedContext } from '../distributed_context/DistributedContext';
17+
import { CorrelationContext } from '../correlation_context/CorrelationContext';
1818
import { SpanContext } from '../trace/span_context';
1919

2020
/**
@@ -118,13 +118,13 @@ export interface MetricUtils {
118118
record(
119119
value: number,
120120
labelSet: LabelSet,
121-
distContext: DistributedContext
121+
correlationContext: CorrelationContext
122122
): void;
123123

124124
record(
125125
value: number,
126126
labelSet: LabelSet,
127-
distContext: DistributedContext,
127+
correlationContext: CorrelationContext,
128128
spanContext: SpanContext
129129
): void;
130130
}

packages/opentelemetry-api/src/metrics/NoopMeter.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { Meter } from './Meter';
1818
import { MetricOptions, Metric, Labels, LabelSet, MetricUtils } from './Metric';
1919
import { BoundMeasure, BoundCounter } from './BoundInstrument';
20-
import { DistributedContext } from '../distributed_context/DistributedContext';
20+
import { CorrelationContext } from '../correlation_context/CorrelationContext';
2121
import { SpanContext } from '../trace/span_context';
2222

2323
/**
@@ -107,15 +107,15 @@ export class NoopMeasureMetric extends NoopMetric<BoundMeasure>
107107
record(
108108
value: number,
109109
labelSet: LabelSet,
110-
distContext?: DistributedContext,
110+
correlationContext?: CorrelationContext,
111111
spanContext?: SpanContext
112112
) {
113-
if (typeof distContext === 'undefined') {
113+
if (typeof correlationContext === 'undefined') {
114114
this.bind(labelSet).record(value);
115115
} else if (typeof spanContext === 'undefined') {
116-
this.bind(labelSet).record(value, distContext);
116+
this.bind(labelSet).record(value, correlationContext);
117117
} else {
118-
this.bind(labelSet).record(value, distContext, spanContext);
118+
this.bind(labelSet).record(value, correlationContext, spanContext);
119119
}
120120
}
121121
}
@@ -129,7 +129,7 @@ export class NoopBoundCounter implements BoundCounter {
129129
export class NoopBoundMeasure implements BoundMeasure {
130130
record(
131131
value: number,
132-
distContext?: DistributedContext,
132+
correlationContext?: CorrelationContext,
133133
spanContext?: SpanContext
134134
): void {
135135
return;

packages/opentelemetry-api/src/trace/span_context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { TraceState } from './trace_state';
1919

2020
/**
2121
* A SpanContext represents the portion of a {@link Span} which must be
22-
* serialized and propagated along side of a {@link DistributedContext}.
22+
* serialized and propagated along side of a {@link CorrelationContext}.
2323
*/
2424
export interface SpanContext {
2525
/**

packages/opentelemetry-metrics/src/BoundInstrument.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class BoundMeasure extends BaseBoundInstrument
116116

117117
record(
118118
value: number,
119-
distContext?: types.DistributedContext,
119+
correlationContext?: types.CorrelationContext,
120120
spanContext?: types.SpanContext
121121
): void {
122122
if (this._absolute && value < 0) {

0 commit comments

Comments
 (0)