New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/metrics

Package Overview
Dependencies
Maintainers
5
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/metrics - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

26

build/src/BoundInstrument.d.ts

@@ -16,3 +16,3 @@ /*!

*/
import * as types from '@opentelemetry/api';
import * as api from '@opentelemetry/api';
import { Aggregator } from './export/types';

@@ -27,8 +27,8 @@ /**

private readonly _aggregator;
protected _labels: types.Labels;
protected _logger: types.Logger;
protected _labels: api.Labels;
protected _logger: api.Logger;
protected _monotonic: boolean;
constructor(labels: types.Labels, logger: types.Logger, monotonic: boolean, _disabled: boolean, _valueType: types.ValueType, _aggregator: Aggregator);
constructor(labels: api.Labels, logger: api.Logger, monotonic: boolean, _disabled: boolean, _valueType: api.ValueType, _aggregator: Aggregator);
update(value: number): void;
getLabels(): types.Labels;
getLabels(): api.Labels;
getAggregator(): Aggregator;

@@ -40,4 +40,4 @@ }

*/
export declare class BoundCounter extends BaseBoundInstrument implements types.BoundCounter {
constructor(labels: types.Labels, disabled: boolean, monotonic: boolean, valueType: types.ValueType, logger: types.Logger, aggregator: Aggregator);
export declare class BoundCounter extends BaseBoundInstrument implements api.BoundCounter {
constructor(labels: api.Labels, disabled: boolean, monotonic: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator);
add(value: number): void;

@@ -48,6 +48,6 @@ }

*/
export declare class BoundMeasure extends BaseBoundInstrument implements types.BoundMeasure {
export declare class BoundMeasure extends BaseBoundInstrument implements api.BoundMeasure {
private readonly _absolute;
constructor(labels: types.Labels, disabled: boolean, monotonic: boolean, absolute: boolean, valueType: types.ValueType, logger: types.Logger, aggregator: Aggregator);
record(value: number, correlationContext?: types.CorrelationContext, spanContext?: types.SpanContext): void;
constructor(labels: api.Labels, disabled: boolean, monotonic: boolean, absolute: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator);
record(value: number, correlationContext?: api.CorrelationContext, spanContext?: api.SpanContext): void;
}

@@ -57,5 +57,5 @@ /**

*/
export declare class BoundObserver extends BaseBoundInstrument implements types.BoundObserver {
constructor(labels: types.Labels, disabled: boolean, monotonic: boolean, valueType: types.ValueType, logger: types.Logger, aggregator: Aggregator);
setCallback(callback: (observerResult: types.ObserverResult) => void): void;
export declare class BoundObserver extends BaseBoundInstrument {
constructor(labels: api.Labels, disabled: boolean, monotonic: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator);
}
//# sourceMappingURL=BoundInstrument.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
const types = require("@opentelemetry/api");
const ObserverResult_1 = require("./ObserverResult");
const api = require("@opentelemetry/api");
/**

@@ -37,3 +36,3 @@ * This class represent the base to BoundInstrument, which is responsible for generating

return;
if (this._valueType === types.ValueType.INT && !Number.isInteger(value)) {
if (this._valueType === api.ValueType.INT && !Number.isInteger(value)) {
this._logger.warn(`INT value type cannot accept a floating-point value for ${Object.values(this._labels)}, ignoring the fractional digits.`);

@@ -93,8 +92,4 @@ value = Math.trunc(value);

}
setCallback(callback) {
const observerResult = new ObserverResult_1.ObserverResult();
callback(observerResult);
}
}
exports.BoundObserver = BoundObserver;
//# sourceMappingURL=BoundInstrument.js.map

@@ -24,1 +24,2 @@ /*!

}
//# sourceMappingURL=countersum.d.ts.map

@@ -32,1 +32,2 @@ /*!

}
//# sourceMappingURL=histogram.d.ts.map

@@ -20,1 +20,2 @@ /*!

export * from './histogram';
//# sourceMappingURL=index.d.ts.map

@@ -25,1 +25,2 @@ /*!

}
//# sourceMappingURL=measureexact.d.ts.map

@@ -24,1 +24,2 @@ /*!

}
//# sourceMappingURL=observer.d.ts.map

@@ -16,3 +16,3 @@ /*!

*/
import { MetricRecord, MetricKind, Aggregator } from './types';
import { MetricRecord, Aggregator, MetricDescriptor } from './types';
/**

@@ -27,4 +27,4 @@ * Base class for all batcher types.

protected readonly _batchMap: Map<string, MetricRecord>;
/** Returns an aggregator based off metric kind. */
abstract aggregatorFor(metricKind: MetricKind): Aggregator;
/** Returns an aggregator based off metric descriptor. */
abstract aggregatorFor(metricKind: MetricDescriptor): Aggregator;
/** Stores record information to be ready for exporting. */

@@ -39,4 +39,5 @@ abstract process(record: MetricRecord): void;

export declare class UngroupedBatcher extends Batcher {
aggregatorFor(metricKind: MetricKind): Aggregator;
aggregatorFor(metricDescriptor: MetricDescriptor): Aggregator;
process(record: MetricRecord): void;
}
//# sourceMappingURL=Batcher.d.ts.map

@@ -41,4 +41,4 @@ "use strict";

class UngroupedBatcher extends Batcher {
aggregatorFor(metricKind) {
switch (metricKind) {
aggregatorFor(metricDescriptor) {
switch (metricDescriptor.metricKind) {
case types_1.MetricKind.COUNTER:

@@ -45,0 +45,0 @@ return new aggregators_1.CounterSumAggregator();

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

import { MetricExporter, MetricRecord } from './types';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';
/**

@@ -27,1 +27,2 @@ * This is implementation of {@link MetricExporter} that prints metrics data to

}
//# sourceMappingURL=ConsoleMetricExporter.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("@opentelemetry/base");
const core_1 = require("@opentelemetry/core");
/**

@@ -49,3 +49,3 @@ * This is implementation of {@link MetricExporter} that prints metrics data to

}
return resultCallback(base_1.ExportResult.SUCCESS);
return resultCallback(core_1.ExportResult.SUCCESS);
}

@@ -52,0 +52,0 @@ shutdown() {

@@ -28,1 +28,2 @@ /*!

}
//# sourceMappingURL=Controller.d.ts.map

@@ -19,3 +19,2 @@ "use strict";

const core_1 = require("@opentelemetry/core");
const base_1 = require("@opentelemetry/base");
const DEFAULT_EXPORT_INTERVAL = 60000;

@@ -39,3 +38,3 @@ class Controller {

this._exporter.export(this._meter.getBatcher().checkPointSet(), result => {
if (result !== base_1.ExportResult.SUCCESS) {
if (result !== core_1.ExportResult.SUCCESS) {
// @todo: log error

@@ -42,0 +41,0 @@ }

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

import { MetricExporter, MetricRecord } from './types';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';
export declare class NoopExporter implements MetricExporter {

@@ -23,1 +23,2 @@ export(metrics: MetricRecord[], resultCallback: (result: ExportResult) => void): void;

}
//# sourceMappingURL=NoopExporter.d.ts.map

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

import { ValueType, HrTime, Labels } from '@opentelemetry/api';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';
/** The kind of metric. */

@@ -98,1 +98,2 @@ export declare enum MetricKind {

}
//# sourceMappingURL=types.d.ts.map

@@ -24,1 +24,2 @@ /*!

export * from './export/types';
//# sourceMappingURL=index.d.ts.map

@@ -16,3 +16,3 @@ /*!

*/
import * as types from '@opentelemetry/api';
import * as api from '@opentelemetry/api';
import { MeterConfig } from './types';

@@ -23,3 +23,3 @@ import { Batcher } from './export/Batcher';

*/
export declare class Meter implements types.Meter {
export declare class Meter implements api.Meter {
private readonly _logger;

@@ -38,3 +38,3 @@ private readonly _metrics;

*/
createMeasure(name: string, options?: types.MetricOptions): types.Metric<types.BoundMeasure>;
createMeasure(name: string, options?: api.MetricOptions): api.Measure;
/**

@@ -47,3 +47,3 @@ * Creates a new counter metric. Generally, this kind of metric when the

*/
createCounter(name: string, options?: types.MetricOptions): types.Metric<types.BoundCounter>;
createCounter(name: string, options?: api.MetricOptions): api.Counter;
/**

@@ -54,3 +54,3 @@ * Creates a new observer metric.

*/
createObserver(name: string, options?: types.MetricOptions): types.Metric<types.BoundObserver>;
createObserver(name: string, options?: api.MetricOptions): api.Observer;
/**

@@ -86,1 +86,2 @@ * Collects all the metrics created with this `Meter` for export.

}
//# sourceMappingURL=Meter.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
const types = require("@opentelemetry/api");
const api = require("@opentelemetry/api");
const core_1 = require("@opentelemetry/core");

@@ -53,3 +53,3 @@ const resources_1 = require("@opentelemetry/resources");

this._logger.warn(`Invalid metric name ${name}. Defaulting to noop metric implementation.`);
return types.NOOP_MEASURE_METRIC;
return api.NOOP_MEASURE_METRIC;
}

@@ -71,3 +71,3 @@ const opt = Object.assign(Object.assign({ absolute: true, monotonic: false, logger: this._logger }, types_1.DEFAULT_METRIC_OPTIONS), options);

this._logger.warn(`Invalid metric name ${name}. Defaulting to noop metric implementation.`);
return types.NOOP_COUNTER_METRIC;
return api.NOOP_COUNTER_METRIC;
}

@@ -87,3 +87,3 @@ const opt = Object.assign(Object.assign({ monotonic: true, absolute: false, logger: this._logger }, types_1.DEFAULT_METRIC_OPTIONS), options);

this._logger.warn(`Invalid metric name ${name}. Defaulting to noop metric implementation.`);
return types.NOOP_OBSERVER_METRIC;
return api.NOOP_OBSERVER_METRIC;
}

@@ -90,0 +90,0 @@ const opt = Object.assign(Object.assign({ monotonic: false, absolute: false, logger: this._logger }, types_1.DEFAULT_METRIC_OPTIONS), options);

@@ -16,3 +16,3 @@ /*!

*/
import * as types from '@opentelemetry/api';
import * as api from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';

@@ -24,8 +24,8 @@ import { Meter } from '.';

*/
export declare class MeterProvider implements types.MeterProvider {
private _config;
export declare class MeterProvider implements api.MeterProvider {
private readonly _config;
private readonly _meters;
readonly resource: Resource;
readonly logger: types.Logger;
constructor(_config?: MeterConfig);
readonly logger: api.Logger;
constructor(config?: MeterConfig);
/**

@@ -38,1 +38,2 @@ * Returns a Meter, creating one if one with the given name and version is not already created

}
//# sourceMappingURL=MeterProvider.d.ts.map

@@ -26,7 +26,11 @@ "use strict";

class MeterProvider {
constructor(_config = types_1.DEFAULT_CONFIG) {
this._config = _config;
constructor(config = types_1.DEFAULT_CONFIG) {
var _a, _b;
this._meters = new Map();
this.resource = resources_1.Resource.createTelemetrySDKResource();
this.logger = _config.logger || new core_1.ConsoleLogger(_config.logLevel);
this.logger = (_a = config.logger, (_a !== null && _a !== void 0 ? _a : new core_1.ConsoleLogger(config.logLevel)));
this.resource = (_b = config.resource, (_b !== null && _b !== void 0 ? _b : resources_1.Resource.createTelemetrySDKResource()));
this._config = Object.assign({}, config, {
logger: this.logger,
resource: this.resource,
});
}

@@ -33,0 +37,0 @@ /**

@@ -20,6 +20,6 @@ /*!

import { MetricOptions } from './types';
import { MetricKind, MetricRecord } from './export/types';
import { MetricKind, MetricDescriptor, MetricRecord } from './export/types';
import { Batcher } from './export/Batcher';
/** This is a SDK implementation of {@link Metric} interface. */
export declare abstract class Metric<T extends BaseBoundInstrument> implements api.Metric<T> {
export declare abstract class Metric<T extends BaseBoundInstrument> implements api.UnboundMetric<T> {
private readonly _name;

@@ -33,3 +33,3 @@ private readonly _options;

protected readonly _logger: api.Logger;
private readonly _descriptor;
protected readonly _descriptor: MetricDescriptor;
private readonly _instruments;

@@ -59,3 +59,3 @@ constructor(_name: string, _options: MetricOptions, _kind: MetricKind, resource: Resource);

/** This is a SDK implementation of Counter Metric. */
export declare class CounterMetric extends Metric<BoundCounter> implements Pick<api.MetricUtils, 'add'> {
export declare class CounterMetric extends Metric<BoundCounter> implements api.Counter {
private readonly _batcher;

@@ -72,3 +72,3 @@ constructor(name: string, options: MetricOptions, _batcher: Batcher, resource: Resource);

}
export declare class MeasureMetric extends Metric<BoundMeasure> implements Pick<api.MetricUtils, 'record'> {
export declare class MeasureMetric extends Metric<BoundMeasure> implements api.Measure {
private readonly _batcher;

@@ -81,3 +81,3 @@ protected readonly _absolute: boolean;

/** This is a SDK implementation of Observer Metric. */
export declare class ObserverMetric extends Metric<BoundObserver> implements Pick<api.MetricUtils, 'setCallback'> {
export declare class ObserverMetric extends Metric<BoundObserver> implements api.Observer {
private readonly _batcher;

@@ -94,1 +94,2 @@ private _observerResult;

}
//# sourceMappingURL=Metric.d.ts.map

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

// @todo: consider to set to CounterSumAggregator always.
this._batcher.aggregatorFor(types_1.MetricKind.COUNTER));
this._batcher.aggregatorFor(this._descriptor));
}

@@ -114,3 +114,3 @@ /**

_makeInstrument(labels) {
return new BoundInstrument_1.BoundMeasure(labels, this._disabled, this._monotonic, this._absolute, this._valueType, this._logger, this._batcher.aggregatorFor(types_1.MetricKind.MEASURE));
return new BoundInstrument_1.BoundMeasure(labels, this._disabled, this._monotonic, this._absolute, this._valueType, this._logger, this._batcher.aggregatorFor(this._descriptor));
}

@@ -130,3 +130,3 @@ record(value, labels) {

_makeInstrument(labels) {
return new BoundInstrument_1.BoundObserver(labels, this._disabled, this._monotonic, this._valueType, this._logger, this._batcher.aggregatorFor(types_1.MetricKind.OBSERVER));
return new BoundInstrument_1.BoundObserver(labels, this._disabled, this._monotonic, this._valueType, this._logger, this._batcher.aggregatorFor(this._descriptor));
}

@@ -133,0 +133,0 @@ getMetricRecord() {

@@ -26,1 +26,2 @@ /*!

}
//# sourceMappingURL=MetricObservable.d.ts.map

@@ -25,1 +25,2 @@ /*!

}
//# sourceMappingURL=ObserverResult.d.ts.map

@@ -71,1 +71,2 @@ /*!

};
//# sourceMappingURL=types.d.ts.map

@@ -28,1 +28,2 @@ /*!

export declare function hashLabels(labels: Labels): string;
//# sourceMappingURL=Utils.d.ts.map

@@ -16,2 +16,3 @@ /*!

*/
export declare const VERSION = "0.7.0";
export declare const VERSION = "0.8.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.7.0';
exports.VERSION = '0.8.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/metrics",
"version": "0.7.0",
"version": "0.8.0",
"description": "OpenTelemetry metrics SDK",

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

"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/resources": "^0.7.0"
"@opentelemetry/api": "^0.8.0",
"@opentelemetry/core": "^0.8.0",
"@opentelemetry/resources": "^0.8.0"
}
}
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