From 5b7ec3bb43372c3d8bee3fe0add2af472230a100 Mon Sep 17 00:00:00 2001 From: Michael Goin Date: Mon, 31 Aug 2020 14:56:02 -0700 Subject: [PATCH] fix: updates ValueRecorder to allow negative values (#1373) --- api/src/metrics/BoundInstrument.ts | 13 ------------- api/src/metrics/Metric.ts | 21 --------------------- api/src/metrics/NoopMeter.ts | 15 ++------------- 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/api/src/metrics/BoundInstrument.ts b/api/src/metrics/BoundInstrument.ts index 4ffbd143c7..0d5554771e 100644 --- a/api/src/metrics/BoundInstrument.ts +++ b/api/src/metrics/BoundInstrument.ts @@ -14,9 +14,6 @@ * limitations under the License. */ -import { CorrelationContext } from '../correlation_context/CorrelationContext'; -import { SpanContext } from '../trace/span_context'; - /** An Instrument for Counter Metric. */ export interface BoundCounter { /** @@ -31,18 +28,8 @@ export interface BoundValueRecorder { /** * Records the given value to this value recorder. * @param value to record. - * @param correlationContext the correlationContext associated with the - * values. - * @param spanContext the {@link SpanContext} that identifies the {@link Span} - * which the values are associated with. */ record(value: number): void; - record(value: number, correlationContext: CorrelationContext): void; - record( - value: number, - correlationContext: CorrelationContext, - spanContext: SpanContext - ): void; } /** An Instrument for Base Observer */ diff --git a/api/src/metrics/Metric.ts b/api/src/metrics/Metric.ts index ee7fd29ab4..0022c2a5b6 100644 --- a/api/src/metrics/Metric.ts +++ b/api/src/metrics/Metric.ts @@ -14,8 +14,6 @@ * limitations under the License. */ -import { CorrelationContext } from '../correlation_context/CorrelationContext'; -import { SpanContext } from '../trace/span_context'; import { BoundBaseObserver, BoundCounter, @@ -51,12 +49,6 @@ export interface MetricOptions { */ disabled?: boolean; - /** - * (Measure only, default true) Asserts that this metric will only accept - * non-negative values (e.g. disk usage). - */ - absolute?: boolean; - /** * Indicates the type of the recorded value. * @default {@link ValueType.DOUBLE} @@ -148,19 +140,6 @@ export interface ValueRecorder extends UnboundMetric { * Records the given value to this value recorder. */ record(value: number, labels?: Labels): void; - - record( - value: number, - labels: Labels, - correlationContext: CorrelationContext - ): void; - - record( - value: number, - labels: Labels, - correlationContext: CorrelationContext, - spanContext: SpanContext - ): void; } /** Base interface for the Observer metrics. */ diff --git a/api/src/metrics/NoopMeter.ts b/api/src/metrics/NoopMeter.ts index d09a6ba742..765a0fd8ae 100644 --- a/api/src/metrics/NoopMeter.ts +++ b/api/src/metrics/NoopMeter.ts @@ -142,19 +142,8 @@ export class NoopCounterMetric export class NoopValueRecorderMetric extends NoopMetric implements ValueRecorder { - record( - value: number, - labels: Labels, - correlationContext?: CorrelationContext, - spanContext?: SpanContext - ) { - if (typeof correlationContext === 'undefined') { - this.bind(labels).record(value); - } else if (typeof spanContext === 'undefined') { - this.bind(labels).record(value, correlationContext); - } else { - this.bind(labels).record(value, correlationContext, spanContext); - } + record(value: number, labels: Labels) { + this.bind(labels).record(value); } }