Skip to content

Commit

Permalink
fixup! feat(instrumentation): added synchronous gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonb committed May 18, 2024
1 parent 40dcded commit c40fc1d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion api/src/metrics/NoopMeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class NoopMeter implements Meter {
/**
* @see {@link Meter.createGauge}
*/
createGauge(_name: string, _options?: MetricOptions): Histogram {
createGauge(_name: string, _options?: MetricOptions): Gauge {
return NOOP_GAUGE_METRIC;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-metrics/src/Instruments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
ObservableCounter,
ObservableGauge,
ObservableUpDownCounter,
Gauge,
} from '@opentelemetry/api';
import { millisToHrTime } from '@opentelemetry/core';
import { InstrumentDescriptor } from './InstrumentDescriptor';
Expand All @@ -36,7 +37,6 @@ import {
AsyncWritableMetricStorage,
WritableMetricStorage,
} from './state/WritableMetricStorage';
import { Gauge } from './types';

export class SyncInstrument {
constructor(
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk-metrics/src/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
BatchObservableCallback,
Observable,
Attributes,
Gauge,
} from '@opentelemetry/api';
import {
createInstrumentDescriptor,
Expand All @@ -41,7 +42,6 @@ import {
UpDownCounterInstrument,
} from './Instruments';
import { MeterSharedState } from './state/MeterSharedState';
import { Gauge } from './types';

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

/**
* Create a {@link Gauge} instrument.
* @experimental
*/
createGauge<AttributesTypes extends Attributes = Attributes>(
name: string,
Expand Down
16 changes: 0 additions & 16 deletions packages/sdk-metrics/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Context, MetricAttributes } from '@opentelemetry/api';

export type CommonReaderOptions = {
timeoutMillis?: number;
Expand All @@ -24,18 +23,3 @@ export type CollectionOptions = CommonReaderOptions;
export type ShutdownOptions = CommonReaderOptions;

export type ForceFlushOptions = CommonReaderOptions;

/**
* @experimental
*
* This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.9.0 and up.
* In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround.
*/
export interface Gauge<
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Records a measurement. Value of the measurement must not be negative.
*/
record(value: number, attributes?: AttributesTypes, context?: Context): void;
}

0 comments on commit c40fc1d

Please sign in to comment.