OpenTelemetry SDK
    Preparing search index...

    An interface to allow the recording metrics.

    Metrics are used for recording pre-defined aggregation (Counter), or raw values (Histogram) in which the aggregation and attributes for the exported metric are deferred.

    1.3.0

    interface Meter {
        addBatchObservableCallback<
            AttributesTypes extends Attributes = Attributes,
        >(
            callback: BatchObservableCallback<AttributesTypes>,
            observables: Observable<AttributesTypes>[],
        ): void;
        createCounter<AttributesTypes extends Attributes = Attributes>(
            name: string,
            options?: MetricOptions,
        ): Counter<AttributesTypes>;
        createGauge<AttributesTypes extends Attributes = Attributes>(
            name: string,
            options?: MetricOptions,
        ): Gauge<AttributesTypes>;
        createHistogram<AttributesTypes extends Attributes = Attributes>(
            name: string,
            options?: MetricOptions,
        ): Histogram<AttributesTypes>;
        createObservableCounter<AttributesTypes extends Attributes = Attributes>(
            name: string,
            options?: MetricOptions,
        ): ObservableCounter<AttributesTypes>;
        createObservableGauge<AttributesTypes extends Attributes = Attributes>(
            name: string,
            options?: MetricOptions,
        ): ObservableGauge<AttributesTypes>;
        createObservableUpDownCounter<
            AttributesTypes extends Attributes = Attributes,
        >(
            name: string,
            options?: MetricOptions,
        ): ObservableUpDownCounter<AttributesTypes>;
        createUpDownCounter<AttributesTypes extends Attributes = Attributes>(
            name: string,
            options?: MetricOptions,
        ): UpDownCounter<AttributesTypes>;
        removeBatchObservableCallback<
            AttributesTypes extends Attributes = Attributes,
        >(
            callback: BatchObservableCallback<AttributesTypes>,
            observables: Observable<AttributesTypes>[],
        ): void;
    }
    Index

    Methods

    • Creates a new UpDownCounter metric. UpDownCounter is a synchronous instrument and very similar to Counter except that Add(increment) supports negative increments. It is generally useful for capturing changes in an amount of resources used, or any quantity that rises and falls during a request. Example uses for UpDownCounter:

      1. count the number of active requests.
      2. count memory in use by instrumenting new and delete.
      3. count queue size by instrumenting enqueue and dequeue.
      4. count semaphore up and down operations.

      Type Parameters

      Parameters

      • name: string

        the name of the metric.

      • Optionaloptions: MetricOptions

        the metric options.

      Returns UpDownCounter<AttributesTypes>