rename DistributedContext to CorrelationContext (#834)

This commit is contained in:
Mayur Kale 2020-03-04 10:43:11 -08:00 committed by GitHub
parent 1b214641bb
commit fd9c7ab86b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 22 deletions

View File

@ -17,13 +17,13 @@
import { EntryValue } from './EntryValue'; import { EntryValue } from './EntryValue';
/** /**
* DistributedContext represents collection of entries. Each key of * CorrelationContext represents collection of entries. Each key of
* DistributedContext is associated with exactly one value. DistributedContext * CorrelationContext is associated with exactly one value. CorrelationContext
* is serializable, to facilitate propagating it not only inside the process * is serializable, to facilitate propagating it not only inside the process
* but also across process boundaries. DistributedContext is used to annotate * but also across process boundaries. CorrelationContext is used to annotate
* telemetry with the name:value pair Entry. Those values can be used to add * telemetry with the name:value pair Entry. Those values can be used to add
* dimension to the metric or additional contest properties to logs and traces. * dimension to the metric or additional contest properties to logs and traces.
*/ */
export interface DistributedContext { export interface CorrelationContext {
[entryKey: string]: EntryValue; [entryKey: string]: EntryValue;
} }

View File

@ -16,7 +16,7 @@
/** /**
* {@link EntryValue} contains properties associated with a {@link * {@link EntryValue} contains properties associated with a {@link
* DistributedContext}. * CorrelationContext}.
*/ */
export interface EntryValue { export interface EntryValue {
/** `String` value of the `EntryValue`. */ /** `String` value of the `EntryValue`. */

View File

@ -18,8 +18,8 @@ export * from './common/Logger';
export * from './common/Time'; export * from './common/Time';
export * from './context/propagation/carrier'; export * from './context/propagation/carrier';
export * from './context/propagation/HttpTextFormat'; export * from './context/propagation/HttpTextFormat';
export * from './distributed_context/DistributedContext'; export * from './correlation_context/CorrelationContext';
export * from './distributed_context/EntryValue'; export * from './correlation_context/EntryValue';
export * from './metrics/BoundInstrument'; export * from './metrics/BoundInstrument';
export * from './metrics/Meter'; export * from './metrics/Meter';
export * from './metrics/MeterProvider'; export * from './metrics/MeterProvider';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { DistributedContext } from '../distributed_context/DistributedContext'; import { CorrelationContext } from '../correlation_context/CorrelationContext';
import { SpanContext } from '../trace/span_context'; import { SpanContext } from '../trace/span_context';
/** An Instrument for Counter Metric. */ /** An Instrument for Counter Metric. */
@ -31,15 +31,16 @@ export interface BoundMeasure {
/** /**
* Records the given value to this measure. * Records the given value to this measure.
* @param value the measurement to record. * @param value the measurement to record.
* @param distContext the distContext associated with the measurements. * @param correlationContext the correlationContext associated with the
* measurements.
* @param spanContext the {@link SpanContext} that identifies the {@link Span} * @param spanContext the {@link SpanContext} that identifies the {@link Span}
* for which the measurements are associated with. * for which the measurements are associated with.
*/ */
record(value: number): void; record(value: number): void;
record(value: number, distContext: DistributedContext): void; record(value: number, correlationContext: CorrelationContext): void;
record( record(
value: number, value: number,
distContext: DistributedContext, correlationContext: CorrelationContext,
spanContext: SpanContext spanContext: SpanContext
): void; ): void;
} }

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { DistributedContext } from '../distributed_context/DistributedContext'; import { CorrelationContext } from '../correlation_context/CorrelationContext';
import { SpanContext } from '../trace/span_context'; import { SpanContext } from '../trace/span_context';
/** /**
@ -118,13 +118,13 @@ export interface MetricUtils {
record( record(
value: number, value: number,
labelSet: LabelSet, labelSet: LabelSet,
distContext: DistributedContext correlationContext: CorrelationContext
): void; ): void;
record( record(
value: number, value: number,
labelSet: LabelSet, labelSet: LabelSet,
distContext: DistributedContext, correlationContext: CorrelationContext,
spanContext: SpanContext spanContext: SpanContext
): void; ): void;
} }

View File

@ -17,7 +17,7 @@
import { Meter } from './Meter'; import { Meter } from './Meter';
import { MetricOptions, Metric, Labels, LabelSet, MetricUtils } from './Metric'; import { MetricOptions, Metric, Labels, LabelSet, MetricUtils } from './Metric';
import { BoundMeasure, BoundCounter } from './BoundInstrument'; import { BoundMeasure, BoundCounter } from './BoundInstrument';
import { DistributedContext } from '../distributed_context/DistributedContext'; import { CorrelationContext } from '../correlation_context/CorrelationContext';
import { SpanContext } from '../trace/span_context'; import { SpanContext } from '../trace/span_context';
/** /**
@ -107,15 +107,15 @@ export class NoopMeasureMetric extends NoopMetric<BoundMeasure>
record( record(
value: number, value: number,
labelSet: LabelSet, labelSet: LabelSet,
distContext?: DistributedContext, correlationContext?: CorrelationContext,
spanContext?: SpanContext spanContext?: SpanContext
) { ) {
if (typeof distContext === 'undefined') { if (typeof correlationContext === 'undefined') {
this.bind(labelSet).record(value); this.bind(labelSet).record(value);
} else if (typeof spanContext === 'undefined') { } else if (typeof spanContext === 'undefined') {
this.bind(labelSet).record(value, distContext); this.bind(labelSet).record(value, correlationContext);
} else { } else {
this.bind(labelSet).record(value, distContext, spanContext); this.bind(labelSet).record(value, correlationContext, spanContext);
} }
} }
} }
@ -129,7 +129,7 @@ export class NoopBoundCounter implements BoundCounter {
export class NoopBoundMeasure implements BoundMeasure { export class NoopBoundMeasure implements BoundMeasure {
record( record(
value: number, value: number,
distContext?: DistributedContext, correlationContext?: CorrelationContext,
spanContext?: SpanContext spanContext?: SpanContext
): void { ): void {
return; return;

View File

@ -19,7 +19,7 @@ import { TraceState } from './trace_state';
/** /**
* A SpanContext represents the portion of a {@link Span} which must be * A SpanContext represents the portion of a {@link Span} which must be
* serialized and propagated along side of a {@link DistributedContext}. * serialized and propagated along side of a {@link CorrelationContext}.
*/ */
export interface SpanContext { export interface SpanContext {
/** /**

View File

@ -116,7 +116,7 @@ export class BoundMeasure extends BaseBoundInstrument
record( record(
value: number, value: number,
distContext?: types.DistributedContext, correlationContext?: types.CorrelationContext,
spanContext?: types.SpanContext spanContext?: types.SpanContext
): void { ): void {
if (this._absolute && value < 0) { if (this._absolute && value < 0) {