Socket
Socket
Sign inDemoInstall

@opentelemetry/api-metrics

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/api-metrics - npm Package Compare versions

Comparing version 0.28.0 to 0.29.0

56

build/esm/NoopMeter.d.ts
import { Meter } from './types/Meter';
import { MetricOptions, MetricAttributes, Counter, Histogram, UpDownCounter, ObservableCallback } from './types/Metric';
import { BatchObservableCallback, Counter, Histogram, MetricOptions, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, MetricAttributes, Observable } from './types/Metric';
/**

@@ -10,40 +10,33 @@ * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses

/**
* Returns a constant noop histogram.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createHistogram}
*/
createHistogram(_name: string, _options?: MetricOptions): Histogram;
/**
* Returns a constant noop counter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createCounter}
*/
createCounter(_name: string, _options?: MetricOptions): Counter;
/**
* Returns a constant noop UpDownCounter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createUpDownCounter}
*/
createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter;
/**
* Returns a constant noop observable gauge.
* @param name the name of the metric.
* @param callback the observable gauge callback
* @param [options] the metric options.
* @see {@link Meter.createObservableGauge}
*/
createObservableGauge(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge;
/**
* Returns a constant noop observable counter.
* @param name the name of the metric.
* @param callback the observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableCounter}
*/
createObservableCounter(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter;
/**
* Returns a constant noop up down observable counter.
* @param name the name of the metric.
* @param callback the up down observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableUpDownCounter}
*/
createObservableUpDownCounter(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter;
/**
* @see {@link Meter.addBatchObservableCallback}
*/
addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void;
/**
* @see {@link Meter.removeBatchObservableCallback}
*/
removeBatchObservableCallback(_callback: BatchObservableCallback): void;
}

@@ -61,2 +54,12 @@ export declare class NoopMetric {

}
export declare class NoopObservableMetric {
addCallback(_callback: ObservableCallback): void;
removeCallback(_callback: ObservableCallback): void;
}
export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter {
}
export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge {
}
export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter {
}
export declare const NOOP_METER: NoopMeter;

@@ -66,2 +69,5 @@ export declare const NOOP_COUNTER_METRIC: NoopCounterMetric;

export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric;
export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric;
export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric;
export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric;
//# sourceMappingURL=NoopMeter.d.ts.map

@@ -39,5 +39,3 @@ /*

/**
* Returns a constant noop histogram.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createHistogram}
*/

@@ -48,5 +46,3 @@ NoopMeter.prototype.createHistogram = function (_name, _options) {

/**
* Returns a constant noop counter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createCounter}
*/

@@ -57,5 +53,3 @@ NoopMeter.prototype.createCounter = function (_name, _options) {

/**
* Returns a constant noop UpDownCounter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createUpDownCounter}
*/

@@ -66,22 +60,27 @@ NoopMeter.prototype.createUpDownCounter = function (_name, _options) {

/**
* Returns a constant noop observable gauge.
* @param name the name of the metric.
* @param callback the observable gauge callback
* @param [options] the metric options.
* @see {@link Meter.createObservableGauge}
*/
NoopMeter.prototype.createObservableGauge = function (_name, _callback, _options) { };
NoopMeter.prototype.createObservableGauge = function (_name, _options) {
return NOOP_OBSERVABLE_GAUGE_METRIC;
};
/**
* Returns a constant noop observable counter.
* @param name the name of the metric.
* @param callback the observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableCounter}
*/
NoopMeter.prototype.createObservableCounter = function (_name, _callback, _options) { };
NoopMeter.prototype.createObservableCounter = function (_name, _options) {
return NOOP_OBSERVABLE_COUNTER_METRIC;
};
/**
* Returns a constant noop up down observable counter.
* @param name the name of the metric.
* @param callback the up down observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableUpDownCounter}
*/
NoopMeter.prototype.createObservableUpDownCounter = function (_name, _callback, _options) { };
NoopMeter.prototype.createObservableUpDownCounter = function (_name, _options) {
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
};
/**
* @see {@link Meter.addBatchObservableCallback}
*/
NoopMeter.prototype.addBatchObservableCallback = function (_callback, _observables) { };
/**
* @see {@link Meter.removeBatchObservableCallback}
*/
NoopMeter.prototype.removeBatchObservableCallback = function (_callback) { };
return NoopMeter;

@@ -123,2 +122,34 @@ }());

export { NoopHistogramMetric };
var NoopObservableMetric = /** @class */ (function () {
function NoopObservableMetric() {
}
NoopObservableMetric.prototype.addCallback = function (_callback) { };
NoopObservableMetric.prototype.removeCallback = function (_callback) { };
return NoopObservableMetric;
}());
export { NoopObservableMetric };
var NoopObservableCounterMetric = /** @class */ (function (_super) {
__extends(NoopObservableCounterMetric, _super);
function NoopObservableCounterMetric() {
return _super !== null && _super.apply(this, arguments) || this;
}
return NoopObservableCounterMetric;
}(NoopObservableMetric));
export { NoopObservableCounterMetric };
var NoopObservableGaugeMetric = /** @class */ (function (_super) {
__extends(NoopObservableGaugeMetric, _super);
function NoopObservableGaugeMetric() {
return _super !== null && _super.apply(this, arguments) || this;
}
return NoopObservableGaugeMetric;
}(NoopObservableMetric));
export { NoopObservableGaugeMetric };
var NoopObservableUpDownCounterMetric = /** @class */ (function (_super) {
__extends(NoopObservableUpDownCounterMetric, _super);
function NoopObservableUpDownCounterMetric() {
return _super !== null && _super.apply(this, arguments) || this;
}
return NoopObservableUpDownCounterMetric;
}(NoopObservableMetric));
export { NoopObservableUpDownCounterMetric };
export var NOOP_METER = new NoopMeter();

@@ -129,2 +160,6 @@ // Synchronous instruments

export var NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();
// Asynchronous instruments
export var NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
export var NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
export var NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
//# sourceMappingURL=NoopMeter.js.map

@@ -1,3 +0,2 @@

import { CounterOptions, HistogramOptions, UpDownCounterOptions } from '..';
import { Counter, Histogram, ObservableCallback, ObservableCounterOptions, ObservableGaugeOptions, ObservableUpDownCounterOptions, UpDownCounter } from './Metric';
import { BatchObservableCallback, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric';
/**

@@ -25,3 +24,3 @@ * An interface describes additional metadata of a meter.

*/
createHistogram(name: string, options?: HistogramOptions): Histogram;
createHistogram(name: string, options?: MetricOptions): Histogram;
/**

@@ -34,3 +33,3 @@ * Creates a new `Counter` metric. Generally, this kind of metric when the

*/
createCounter(name: string, options?: CounterOptions): Counter;
createCounter(name: string, options?: MetricOptions): Counter;
/**

@@ -53,25 +52,56 @@ * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous

*/
createUpDownCounter(name: string, options?: UpDownCounterOptions): UpDownCounter;
createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter;
/**
* Creates a new `ObservableGauge` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableGauge(name: string, callback: ObservableCallback, options?: ObservableGaugeOptions): void;
createObservableGauge(name: string, options?: MetricOptions): ObservableGauge;
/**
* Creates a new `ObservableCounter` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableCounter(name: string, callback: ObservableCallback, options?: ObservableCounterOptions): void;
createObservableCounter(name: string, options?: MetricOptions): ObservableCounter;
/**
* Creates a new `ObservableUpDownCounter` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableUpDownCounter(name: string, callback: ObservableCallback, options?: ObservableUpDownCounterOptions): void;
createObservableUpDownCounter(name: string, options?: MetricOptions): ObservableUpDownCounter;
/**
* Sets up a function that will be called whenever a metric collection is
* initiated.
*
* If the function is already in the list of callbacks for this Observable,
* the function is not added a second time.
*
* Only the associated observables can be observed in the callback.
* Measurements of observables that are not associated observed in the
* callback are dropped.
*
* @param callback the batch observable callback
* @param observables the observables associated with this batch observable callback
*/
addBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void;
/**
* Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.
*
* The callback to be removed is identified using a combination of the callback itself,
* and the set of the observables associated with it.
*
* @param callback the batch observable callback
* @param observables the observables associated with this batch observable callback
*/
removeBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void;
}
//# sourceMappingURL=Meter.d.ts.map
import { Context } from '@opentelemetry/api';
import { ObservableResult } from './ObservableResult';
import { BatchObservableResult, ObservableResult } from './ObservableResult';
/**

@@ -23,8 +23,2 @@ * Options needed for metric creation

}
export declare type CounterOptions = MetricOptions;
export declare type UpDownCounterOptions = MetricOptions;
export declare type ObservableGaugeOptions = MetricOptions;
export declare type ObservableCounterOptions = MetricOptions;
export declare type ObservableUpDownCounterOptions = MetricOptions;
export declare type HistogramOptions = MetricOptions;
/** The Type of value. It describes how the data is reported. */

@@ -78,2 +72,21 @@ export declare enum ValueType {

export declare type ObservableCallback = (observableResult: ObservableResult) => void | Promise<void>;
/**
* The observable callback for a batch of Observable instruments.
*/
export declare type BatchObservableCallback = (observableResult: BatchObservableResult) => void | Promise<void>;
export interface Observable {
/**
* Sets up a function that will be called whenever a metric collection is initiated.
*
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
*/
addCallback(callback: ObservableCallback): void;
/**
* Removes a callback previously registered with {@link Observable.addCallback}.
*/
removeCallback(callback: ObservableCallback): void;
}
export declare type ObservableCounter = Observable;
export declare type ObservableUpDownCounter = Observable;
export declare type ObservableGauge = Observable;
//# sourceMappingURL=Metric.d.ts.map

@@ -1,4 +0,4 @@

import { MetricAttributes } from './Metric';
import { MetricAttributes, Observable } from './Metric';
/**
* Interface that is being used in callback function for Observable Metric
* Interface that is being used in callback function for Observable Metric.
*/

@@ -16,2 +16,17 @@ export interface ObservableResult {

}
/**
* Interface that is being used in batch observable callback function.
*/
export interface BatchObservableResult {
/**
* Observe a measurement of the value associated with the given attributes.
*
* @param metric The observable metric to be observed.
* @param value The value to be observed.
* @param attributes The attributes associated with the value. If more than
* one values associated with the same attributes values, SDK may pick the
* last one or simply drop the entire observable result.
*/
observe(metric: Observable, value: number, attributes?: MetricAttributes): void;
}
//# sourceMappingURL=ObservableResult.d.ts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.28.0";
export declare const VERSION = "0.29.0";
//# sourceMappingURL=version.d.ts.map

@@ -17,3 +17,3 @@ /*

// this is autogenerated file, see scripts/version-update.js
export var VERSION = '0.28.0';
export var VERSION = '0.29.0';
//# sourceMappingURL=version.js.map
import { Meter } from './types/Meter';
import { MetricOptions, MetricAttributes, Counter, Histogram, UpDownCounter, ObservableCallback } from './types/Metric';
import { BatchObservableCallback, Counter, Histogram, MetricOptions, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, MetricAttributes, Observable } from './types/Metric';
/**

@@ -10,40 +10,33 @@ * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses

/**
* Returns a constant noop histogram.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createHistogram}
*/
createHistogram(_name: string, _options?: MetricOptions): Histogram;
/**
* Returns a constant noop counter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createCounter}
*/
createCounter(_name: string, _options?: MetricOptions): Counter;
/**
* Returns a constant noop UpDownCounter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createUpDownCounter}
*/
createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter;
/**
* Returns a constant noop observable gauge.
* @param name the name of the metric.
* @param callback the observable gauge callback
* @param [options] the metric options.
* @see {@link Meter.createObservableGauge}
*/
createObservableGauge(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge;
/**
* Returns a constant noop observable counter.
* @param name the name of the metric.
* @param callback the observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableCounter}
*/
createObservableCounter(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter;
/**
* Returns a constant noop up down observable counter.
* @param name the name of the metric.
* @param callback the up down observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableUpDownCounter}
*/
createObservableUpDownCounter(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter;
/**
* @see {@link Meter.addBatchObservableCallback}
*/
addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void;
/**
* @see {@link Meter.removeBatchObservableCallback}
*/
removeBatchObservableCallback(_callback: BatchObservableCallback): void;
}

@@ -61,2 +54,12 @@ export declare class NoopMetric {

}
export declare class NoopObservableMetric {
addCallback(_callback: ObservableCallback): void;
removeCallback(_callback: ObservableCallback): void;
}
export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter {
}
export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge {
}
export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter {
}
export declare const NOOP_METER: NoopMeter;

@@ -66,2 +69,5 @@ export declare const NOOP_COUNTER_METRIC: NoopCounterMetric;

export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric;
export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric;
export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric;
export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric;
//# sourceMappingURL=NoopMeter.d.ts.map

@@ -23,5 +23,3 @@ /*

/**
* Returns a constant noop histogram.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createHistogram}
*/

@@ -32,5 +30,3 @@ createHistogram(_name, _options) {

/**
* Returns a constant noop counter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createCounter}
*/

@@ -41,5 +37,3 @@ createCounter(_name, _options) {

/**
* Returns a constant noop UpDownCounter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createUpDownCounter}
*/

@@ -50,22 +44,27 @@ createUpDownCounter(_name, _options) {

/**
* Returns a constant noop observable gauge.
* @param name the name of the metric.
* @param callback the observable gauge callback
* @param [options] the metric options.
* @see {@link Meter.createObservableGauge}
*/
createObservableGauge(_name, _callback, _options) { }
createObservableGauge(_name, _options) {
return NOOP_OBSERVABLE_GAUGE_METRIC;
}
/**
* Returns a constant noop observable counter.
* @param name the name of the metric.
* @param callback the observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableCounter}
*/
createObservableCounter(_name, _callback, _options) { }
createObservableCounter(_name, _options) {
return NOOP_OBSERVABLE_COUNTER_METRIC;
}
/**
* Returns a constant noop up down observable counter.
* @param name the name of the metric.
* @param callback the up down observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableUpDownCounter}
*/
createObservableUpDownCounter(_name, _callback, _options) { }
createObservableUpDownCounter(_name, _options) {
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
}
/**
* @see {@link Meter.addBatchObservableCallback}
*/
addBatchObservableCallback(_callback, _observables) { }
/**
* @see {@link Meter.removeBatchObservableCallback}
*/
removeBatchObservableCallback(_callback) { }
}

@@ -83,2 +82,12 @@ export class NoopMetric {

}
export class NoopObservableMetric {
addCallback(_callback) { }
removeCallback(_callback) { }
}
export class NoopObservableCounterMetric extends NoopObservableMetric {
}
export class NoopObservableGaugeMetric extends NoopObservableMetric {
}
export class NoopObservableUpDownCounterMetric extends NoopObservableMetric {
}
export const NOOP_METER = new NoopMeter();

@@ -89,2 +98,6 @@ // Synchronous instruments

export const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();
// Asynchronous instruments
export const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
export const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
export const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
//# sourceMappingURL=NoopMeter.js.map

@@ -1,3 +0,2 @@

import { CounterOptions, HistogramOptions, UpDownCounterOptions } from '..';
import { Counter, Histogram, ObservableCallback, ObservableCounterOptions, ObservableGaugeOptions, ObservableUpDownCounterOptions, UpDownCounter } from './Metric';
import { BatchObservableCallback, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric';
/**

@@ -25,3 +24,3 @@ * An interface describes additional metadata of a meter.

*/
createHistogram(name: string, options?: HistogramOptions): Histogram;
createHistogram(name: string, options?: MetricOptions): Histogram;
/**

@@ -34,3 +33,3 @@ * Creates a new `Counter` metric. Generally, this kind of metric when the

*/
createCounter(name: string, options?: CounterOptions): Counter;
createCounter(name: string, options?: MetricOptions): Counter;
/**

@@ -53,25 +52,56 @@ * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous

*/
createUpDownCounter(name: string, options?: UpDownCounterOptions): UpDownCounter;
createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter;
/**
* Creates a new `ObservableGauge` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableGauge(name: string, callback: ObservableCallback, options?: ObservableGaugeOptions): void;
createObservableGauge(name: string, options?: MetricOptions): ObservableGauge;
/**
* Creates a new `ObservableCounter` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableCounter(name: string, callback: ObservableCallback, options?: ObservableCounterOptions): void;
createObservableCounter(name: string, options?: MetricOptions): ObservableCounter;
/**
* Creates a new `ObservableUpDownCounter` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableUpDownCounter(name: string, callback: ObservableCallback, options?: ObservableUpDownCounterOptions): void;
createObservableUpDownCounter(name: string, options?: MetricOptions): ObservableUpDownCounter;
/**
* Sets up a function that will be called whenever a metric collection is
* initiated.
*
* If the function is already in the list of callbacks for this Observable,
* the function is not added a second time.
*
* Only the associated observables can be observed in the callback.
* Measurements of observables that are not associated observed in the
* callback are dropped.
*
* @param callback the batch observable callback
* @param observables the observables associated with this batch observable callback
*/
addBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void;
/**
* Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.
*
* The callback to be removed is identified using a combination of the callback itself,
* and the set of the observables associated with it.
*
* @param callback the batch observable callback
* @param observables the observables associated with this batch observable callback
*/
removeBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void;
}
//# sourceMappingURL=Meter.d.ts.map
import { Context } from '@opentelemetry/api';
import { ObservableResult } from './ObservableResult';
import { BatchObservableResult, ObservableResult } from './ObservableResult';
/**

@@ -23,8 +23,2 @@ * Options needed for metric creation

}
export declare type CounterOptions = MetricOptions;
export declare type UpDownCounterOptions = MetricOptions;
export declare type ObservableGaugeOptions = MetricOptions;
export declare type ObservableCounterOptions = MetricOptions;
export declare type ObservableUpDownCounterOptions = MetricOptions;
export declare type HistogramOptions = MetricOptions;
/** The Type of value. It describes how the data is reported. */

@@ -78,2 +72,21 @@ export declare enum ValueType {

export declare type ObservableCallback = (observableResult: ObservableResult) => void | Promise<void>;
/**
* The observable callback for a batch of Observable instruments.
*/
export declare type BatchObservableCallback = (observableResult: BatchObservableResult) => void | Promise<void>;
export interface Observable {
/**
* Sets up a function that will be called whenever a metric collection is initiated.
*
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
*/
addCallback(callback: ObservableCallback): void;
/**
* Removes a callback previously registered with {@link Observable.addCallback}.
*/
removeCallback(callback: ObservableCallback): void;
}
export declare type ObservableCounter = Observable;
export declare type ObservableUpDownCounter = Observable;
export declare type ObservableGauge = Observable;
//# sourceMappingURL=Metric.d.ts.map

@@ -1,4 +0,4 @@

import { MetricAttributes } from './Metric';
import { MetricAttributes, Observable } from './Metric';
/**
* Interface that is being used in callback function for Observable Metric
* Interface that is being used in callback function for Observable Metric.
*/

@@ -16,2 +16,17 @@ export interface ObservableResult {

}
/**
* Interface that is being used in batch observable callback function.
*/
export interface BatchObservableResult {
/**
* Observe a measurement of the value associated with the given attributes.
*
* @param metric The observable metric to be observed.
* @param value The value to be observed.
* @param attributes The attributes associated with the value. If more than
* one values associated with the same attributes values, SDK may pick the
* last one or simply drop the entire observable result.
*/
observe(metric: Observable, value: number, attributes?: MetricAttributes): void;
}
//# sourceMappingURL=ObservableResult.d.ts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.28.0";
export declare const VERSION = "0.29.0";
//# sourceMappingURL=version.d.ts.map

@@ -17,3 +17,3 @@ /*

// this is autogenerated file, see scripts/version-update.js
export const VERSION = '0.28.0';
export const VERSION = '0.29.0';
//# sourceMappingURL=version.js.map
import { Meter } from './types/Meter';
import { MetricOptions, MetricAttributes, Counter, Histogram, UpDownCounter, ObservableCallback } from './types/Metric';
import { BatchObservableCallback, Counter, Histogram, MetricOptions, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, MetricAttributes, Observable } from './types/Metric';
/**

@@ -10,40 +10,33 @@ * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses

/**
* Returns a constant noop histogram.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createHistogram}
*/
createHistogram(_name: string, _options?: MetricOptions): Histogram;
/**
* Returns a constant noop counter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createCounter}
*/
createCounter(_name: string, _options?: MetricOptions): Counter;
/**
* Returns a constant noop UpDownCounter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createUpDownCounter}
*/
createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter;
/**
* Returns a constant noop observable gauge.
* @param name the name of the metric.
* @param callback the observable gauge callback
* @param [options] the metric options.
* @see {@link Meter.createObservableGauge}
*/
createObservableGauge(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge;
/**
* Returns a constant noop observable counter.
* @param name the name of the metric.
* @param callback the observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableCounter}
*/
createObservableCounter(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter;
/**
* Returns a constant noop up down observable counter.
* @param name the name of the metric.
* @param callback the up down observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableUpDownCounter}
*/
createObservableUpDownCounter(_name: string, _callback: ObservableCallback, _options?: MetricOptions): void;
createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter;
/**
* @see {@link Meter.addBatchObservableCallback}
*/
addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void;
/**
* @see {@link Meter.removeBatchObservableCallback}
*/
removeBatchObservableCallback(_callback: BatchObservableCallback): void;
}

@@ -61,2 +54,12 @@ export declare class NoopMetric {

}
export declare class NoopObservableMetric {
addCallback(_callback: ObservableCallback): void;
removeCallback(_callback: ObservableCallback): void;
}
export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter {
}
export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge {
}
export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter {
}
export declare const NOOP_METER: NoopMeter;

@@ -66,2 +69,5 @@ export declare const NOOP_COUNTER_METRIC: NoopCounterMetric;

export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric;
export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric;
export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric;
export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric;
//# sourceMappingURL=NoopMeter.d.ts.map

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.NOOP_UP_DOWN_COUNTER_METRIC = exports.NOOP_HISTOGRAM_METRIC = exports.NOOP_COUNTER_METRIC = exports.NOOP_METER = exports.NoopHistogramMetric = exports.NoopUpDownCounterMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0;
exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = exports.NOOP_OBSERVABLE_GAUGE_METRIC = exports.NOOP_OBSERVABLE_COUNTER_METRIC = exports.NOOP_UP_DOWN_COUNTER_METRIC = exports.NOOP_HISTOGRAM_METRIC = exports.NOOP_COUNTER_METRIC = exports.NOOP_METER = exports.NoopObservableUpDownCounterMetric = exports.NoopObservableGaugeMetric = exports.NoopObservableCounterMetric = exports.NoopObservableMetric = exports.NoopHistogramMetric = exports.NoopUpDownCounterMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0;
/**

@@ -27,5 +27,3 @@ * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses

/**
* Returns a constant noop histogram.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createHistogram}
*/

@@ -36,5 +34,3 @@ createHistogram(_name, _options) {

/**
* Returns a constant noop counter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createCounter}
*/

@@ -45,5 +41,3 @@ createCounter(_name, _options) {

/**
* Returns a constant noop UpDownCounter.
* @param name the name of the metric.
* @param [options] the metric options.
* @see {@link Meter.createUpDownCounter}
*/

@@ -54,22 +48,27 @@ createUpDownCounter(_name, _options) {

/**
* Returns a constant noop observable gauge.
* @param name the name of the metric.
* @param callback the observable gauge callback
* @param [options] the metric options.
* @see {@link Meter.createObservableGauge}
*/
createObservableGauge(_name, _callback, _options) { }
createObservableGauge(_name, _options) {
return exports.NOOP_OBSERVABLE_GAUGE_METRIC;
}
/**
* Returns a constant noop observable counter.
* @param name the name of the metric.
* @param callback the observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableCounter}
*/
createObservableCounter(_name, _callback, _options) { }
createObservableCounter(_name, _options) {
return exports.NOOP_OBSERVABLE_COUNTER_METRIC;
}
/**
* Returns a constant noop up down observable counter.
* @param name the name of the metric.
* @param callback the up down observable counter callback
* @param [options] the metric options.
* @see {@link Meter.createObservableUpDownCounter}
*/
createObservableUpDownCounter(_name, _callback, _options) { }
createObservableUpDownCounter(_name, _options) {
return exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
}
/**
* @see {@link Meter.addBatchObservableCallback}
*/
addBatchObservableCallback(_callback, _observables) { }
/**
* @see {@link Meter.removeBatchObservableCallback}
*/
removeBatchObservableCallback(_callback) { }
}

@@ -92,2 +91,16 @@ exports.NoopMeter = NoopMeter;

exports.NoopHistogramMetric = NoopHistogramMetric;
class NoopObservableMetric {
addCallback(_callback) { }
removeCallback(_callback) { }
}
exports.NoopObservableMetric = NoopObservableMetric;
class NoopObservableCounterMetric extends NoopObservableMetric {
}
exports.NoopObservableCounterMetric = NoopObservableCounterMetric;
class NoopObservableGaugeMetric extends NoopObservableMetric {
}
exports.NoopObservableGaugeMetric = NoopObservableGaugeMetric;
class NoopObservableUpDownCounterMetric extends NoopObservableMetric {
}
exports.NoopObservableUpDownCounterMetric = NoopObservableUpDownCounterMetric;
exports.NOOP_METER = new NoopMeter();

@@ -98,2 +111,6 @@ // Synchronous instruments

exports.NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();
// Asynchronous instruments
exports.NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
exports.NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
//# sourceMappingURL=NoopMeter.js.map

@@ -1,3 +0,2 @@

import { CounterOptions, HistogramOptions, UpDownCounterOptions } from '..';
import { Counter, Histogram, ObservableCallback, ObservableCounterOptions, ObservableGaugeOptions, ObservableUpDownCounterOptions, UpDownCounter } from './Metric';
import { BatchObservableCallback, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric';
/**

@@ -25,3 +24,3 @@ * An interface describes additional metadata of a meter.

*/
createHistogram(name: string, options?: HistogramOptions): Histogram;
createHistogram(name: string, options?: MetricOptions): Histogram;
/**

@@ -34,3 +33,3 @@ * Creates a new `Counter` metric. Generally, this kind of metric when the

*/
createCounter(name: string, options?: CounterOptions): Counter;
createCounter(name: string, options?: MetricOptions): Counter;
/**

@@ -53,25 +52,56 @@ * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous

*/
createUpDownCounter(name: string, options?: UpDownCounterOptions): UpDownCounter;
createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter;
/**
* Creates a new `ObservableGauge` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableGauge(name: string, callback: ObservableCallback, options?: ObservableGaugeOptions): void;
createObservableGauge(name: string, options?: MetricOptions): ObservableGauge;
/**
* Creates a new `ObservableCounter` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableCounter(name: string, callback: ObservableCallback, options?: ObservableCounterOptions): void;
createObservableCounter(name: string, options?: MetricOptions): ObservableCounter;
/**
* Creates a new `ObservableUpDownCounter` metric.
*
* The callback SHOULD be safe to be invoked concurrently.
*
* @param name the name of the metric.
* @param callback the observable callback
* @param [options] the metric options.
*/
createObservableUpDownCounter(name: string, callback: ObservableCallback, options?: ObservableUpDownCounterOptions): void;
createObservableUpDownCounter(name: string, options?: MetricOptions): ObservableUpDownCounter;
/**
* Sets up a function that will be called whenever a metric collection is
* initiated.
*
* If the function is already in the list of callbacks for this Observable,
* the function is not added a second time.
*
* Only the associated observables can be observed in the callback.
* Measurements of observables that are not associated observed in the
* callback are dropped.
*
* @param callback the batch observable callback
* @param observables the observables associated with this batch observable callback
*/
addBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void;
/**
* Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.
*
* The callback to be removed is identified using a combination of the callback itself,
* and the set of the observables associated with it.
*
* @param callback the batch observable callback
* @param observables the observables associated with this batch observable callback
*/
removeBatchObservableCallback(callback: BatchObservableCallback, observables: Observable[]): void;
}
//# sourceMappingURL=Meter.d.ts.map
import { Context } from '@opentelemetry/api';
import { ObservableResult } from './ObservableResult';
import { BatchObservableResult, ObservableResult } from './ObservableResult';
/**

@@ -23,8 +23,2 @@ * Options needed for metric creation

}
export declare type CounterOptions = MetricOptions;
export declare type UpDownCounterOptions = MetricOptions;
export declare type ObservableGaugeOptions = MetricOptions;
export declare type ObservableCounterOptions = MetricOptions;
export declare type ObservableUpDownCounterOptions = MetricOptions;
export declare type HistogramOptions = MetricOptions;
/** The Type of value. It describes how the data is reported. */

@@ -78,2 +72,21 @@ export declare enum ValueType {

export declare type ObservableCallback = (observableResult: ObservableResult) => void | Promise<void>;
/**
* The observable callback for a batch of Observable instruments.
*/
export declare type BatchObservableCallback = (observableResult: BatchObservableResult) => void | Promise<void>;
export interface Observable {
/**
* Sets up a function that will be called whenever a metric collection is initiated.
*
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
*/
addCallback(callback: ObservableCallback): void;
/**
* Removes a callback previously registered with {@link Observable.addCallback}.
*/
removeCallback(callback: ObservableCallback): void;
}
export declare type ObservableCounter = Observable;
export declare type ObservableUpDownCounter = Observable;
export declare type ObservableGauge = Observable;
//# sourceMappingURL=Metric.d.ts.map

@@ -1,4 +0,4 @@

import { MetricAttributes } from './Metric';
import { MetricAttributes, Observable } from './Metric';
/**
* Interface that is being used in callback function for Observable Metric
* Interface that is being used in callback function for Observable Metric.
*/

@@ -16,2 +16,17 @@ export interface ObservableResult {

}
/**
* Interface that is being used in batch observable callback function.
*/
export interface BatchObservableResult {
/**
* Observe a measurement of the value associated with the given attributes.
*
* @param metric The observable metric to be observed.
* @param value The value to be observed.
* @param attributes The attributes associated with the value. If more than
* one values associated with the same attributes values, SDK may pick the
* last one or simply drop the entire observable result.
*/
observe(metric: Observable, value: number, attributes?: MetricAttributes): void;
}
//# sourceMappingURL=ObservableResult.d.ts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.28.0";
export declare const VERSION = "0.29.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.28.0';
exports.VERSION = '0.29.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/api-metrics",
"version": "0.28.0",
"version": "0.29.0",
"description": "Public metrics API for OpenTelemetry",

@@ -81,7 +81,7 @@ "main": "build/src/index.js",

"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0"
},
"gitHead": "28a177ffe3950c5602a91391af582a7a8c813c7d"
"gitHead": "eda0b092db484855ded8b4837ba7fc19a377c5a7"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc