Skip to content

Commit 0b02976

Browse files
committed
fixup! feat(instrumentation): added synchronous gauge
1 parent 9b43d49 commit 0b02976

File tree

4 files changed

+3
-20
lines changed

4 files changed

+3
-20
lines changed

api/src/metrics/NoopMeter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class NoopMeter implements Meter {
4040
/**
4141
* @see {@link Meter.createGauge}
4242
*/
43-
createGauge(_name: string, _options?: MetricOptions): Histogram {
43+
createGauge(_name: string, _options?: MetricOptions): Gauge {
4444
return NOOP_GAUGE_METRIC;
4545
}
4646

packages/sdk-metrics/src/Instruments.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
ObservableCounter,
2929
ObservableGauge,
3030
ObservableUpDownCounter,
31+
Gauge,
3132
} from '@opentelemetry/api';
3233
import { millisToHrTime } from '@opentelemetry/core';
3334
import { InstrumentDescriptor } from './InstrumentDescriptor';
@@ -36,7 +37,6 @@ import {
3637
AsyncWritableMetricStorage,
3738
WritableMetricStorage,
3839
} from './state/WritableMetricStorage';
39-
import { Gauge } from './types';
4040

4141
export class SyncInstrument {
4242
constructor(

packages/sdk-metrics/src/Meter.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
BatchObservableCallback,
2727
Observable,
2828
Attributes,
29+
Gauge,
2930
} from '@opentelemetry/api';
3031
import {
3132
createInstrumentDescriptor,
@@ -41,7 +42,6 @@ import {
4142
UpDownCounterInstrument,
4243
} from './Instruments';
4344
import { MeterSharedState } from './state/MeterSharedState';
44-
import { Gauge } from './types';
4545

4646
/**
4747
* This class implements the {@link IMeter} interface.
@@ -51,7 +51,6 @@ export class Meter implements IMeter {
5151

5252
/**
5353
* Create a {@link Gauge} instrument.
54-
* @experimental
5554
*/
5655
createGauge<AttributesTypes extends Attributes = Attributes>(
5756
name: string,

packages/sdk-metrics/src/types.ts

-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { Context, MetricAttributes } from '@opentelemetry/api';
1716

1817
export type CommonReaderOptions = {
1918
timeoutMillis?: number;
@@ -24,18 +23,3 @@ export type CollectionOptions = CommonReaderOptions;
2423
export type ShutdownOptions = CommonReaderOptions;
2524

2625
export type ForceFlushOptions = CommonReaderOptions;
27-
28-
/**
29-
* @experimental
30-
*
31-
* This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.9.0 and up.
32-
* In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround.
33-
*/
34-
export interface Gauge<
35-
AttributesTypes extends MetricAttributes = MetricAttributes,
36-
> {
37-
/**
38-
* Records a measurement. Value of the measurement must not be negative.
39-
*/
40-
record(value: number, attributes?: AttributesTypes, context?: Context): void;
41-
}

0 commit comments

Comments
 (0)