rename DistributedContext to CorrelationContext (#834)
This commit is contained in:
parent
1b214641bb
commit
fd9c7ab86b
|
|
@ -17,13 +17,13 @@
|
|||
import { EntryValue } from './EntryValue';
|
||||
|
||||
/**
|
||||
* DistributedContext represents collection of entries. Each key of
|
||||
* DistributedContext is associated with exactly one value. DistributedContext
|
||||
* CorrelationContext represents collection of entries. Each key of
|
||||
* CorrelationContext is associated with exactly one value. CorrelationContext
|
||||
* 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
|
||||
* dimension to the metric or additional contest properties to logs and traces.
|
||||
*/
|
||||
export interface DistributedContext {
|
||||
export interface CorrelationContext {
|
||||
[entryKey: string]: EntryValue;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/**
|
||||
* {@link EntryValue} contains properties associated with a {@link
|
||||
* DistributedContext}.
|
||||
* CorrelationContext}.
|
||||
*/
|
||||
export interface EntryValue {
|
||||
/** `String` value of the `EntryValue`. */
|
||||
|
|
@ -18,8 +18,8 @@ export * from './common/Logger';
|
|||
export * from './common/Time';
|
||||
export * from './context/propagation/carrier';
|
||||
export * from './context/propagation/HttpTextFormat';
|
||||
export * from './distributed_context/DistributedContext';
|
||||
export * from './distributed_context/EntryValue';
|
||||
export * from './correlation_context/CorrelationContext';
|
||||
export * from './correlation_context/EntryValue';
|
||||
export * from './metrics/BoundInstrument';
|
||||
export * from './metrics/Meter';
|
||||
export * from './metrics/MeterProvider';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DistributedContext } from '../distributed_context/DistributedContext';
|
||||
import { CorrelationContext } from '../correlation_context/CorrelationContext';
|
||||
import { SpanContext } from '../trace/span_context';
|
||||
|
||||
/** An Instrument for Counter Metric. */
|
||||
|
|
@ -31,15 +31,16 @@ export interface BoundMeasure {
|
|||
/**
|
||||
* Records the given value to this measure.
|
||||
* @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}
|
||||
* for which the measurements are associated with.
|
||||
*/
|
||||
record(value: number): void;
|
||||
record(value: number, distContext: DistributedContext): void;
|
||||
record(value: number, correlationContext: CorrelationContext): void;
|
||||
record(
|
||||
value: number,
|
||||
distContext: DistributedContext,
|
||||
correlationContext: CorrelationContext,
|
||||
spanContext: SpanContext
|
||||
): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DistributedContext } from '../distributed_context/DistributedContext';
|
||||
import { CorrelationContext } from '../correlation_context/CorrelationContext';
|
||||
import { SpanContext } from '../trace/span_context';
|
||||
|
||||
/**
|
||||
|
|
@ -118,13 +118,13 @@ export interface MetricUtils {
|
|||
record(
|
||||
value: number,
|
||||
labelSet: LabelSet,
|
||||
distContext: DistributedContext
|
||||
correlationContext: CorrelationContext
|
||||
): void;
|
||||
|
||||
record(
|
||||
value: number,
|
||||
labelSet: LabelSet,
|
||||
distContext: DistributedContext,
|
||||
correlationContext: CorrelationContext,
|
||||
spanContext: SpanContext
|
||||
): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import { Meter } from './Meter';
|
||||
import { MetricOptions, Metric, Labels, LabelSet, MetricUtils } from './Metric';
|
||||
import { BoundMeasure, BoundCounter } from './BoundInstrument';
|
||||
import { DistributedContext } from '../distributed_context/DistributedContext';
|
||||
import { CorrelationContext } from '../correlation_context/CorrelationContext';
|
||||
import { SpanContext } from '../trace/span_context';
|
||||
|
||||
/**
|
||||
|
|
@ -107,15 +107,15 @@ export class NoopMeasureMetric extends NoopMetric<BoundMeasure>
|
|||
record(
|
||||
value: number,
|
||||
labelSet: LabelSet,
|
||||
distContext?: DistributedContext,
|
||||
correlationContext?: CorrelationContext,
|
||||
spanContext?: SpanContext
|
||||
) {
|
||||
if (typeof distContext === 'undefined') {
|
||||
if (typeof correlationContext === 'undefined') {
|
||||
this.bind(labelSet).record(value);
|
||||
} else if (typeof spanContext === 'undefined') {
|
||||
this.bind(labelSet).record(value, distContext);
|
||||
this.bind(labelSet).record(value, correlationContext);
|
||||
} 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 {
|
||||
record(
|
||||
value: number,
|
||||
distContext?: DistributedContext,
|
||||
correlationContext?: CorrelationContext,
|
||||
spanContext?: SpanContext
|
||||
): void {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { TraceState } from './trace_state';
|
|||
|
||||
/**
|
||||
* 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 {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export class BoundMeasure extends BaseBoundInstrument
|
|||
|
||||
record(
|
||||
value: number,
|
||||
distContext?: types.DistributedContext,
|
||||
correlationContext?: types.CorrelationContext,
|
||||
spanContext?: types.SpanContext
|
||||
): void {
|
||||
if (this._absolute && value < 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue