@opentelemetry/metrics
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { MetricRecord } from './export/types'; | ||
@@ -3,0 +3,0 @@ /** This is a SDK implementation of Batch Observer. */ |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Implementation of api BatchObserverResult |
@@ -1,2 +0,3 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import { Logger } from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { Aggregator } from './export/types'; | ||
@@ -12,4 +13,4 @@ /** | ||
protected _labels: api.Labels; | ||
protected _logger: api.Logger; | ||
constructor(labels: api.Labels, logger: api.Logger, _disabled: boolean, _valueType: api.ValueType, _aggregator: Aggregator); | ||
protected _logger: Logger; | ||
constructor(labels: api.Labels, logger: Logger, _disabled: boolean, _valueType: api.ValueType, _aggregator: Aggregator); | ||
update(value: number): void; | ||
@@ -24,3 +25,3 @@ getLabels(): api.Labels; | ||
export declare class BoundCounter extends BaseBoundInstrument implements api.BoundCounter { | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator); | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: Logger, aggregator: Aggregator); | ||
add(value: number): void; | ||
@@ -34,3 +35,3 @@ } | ||
export declare class BoundUpDownCounter extends BaseBoundInstrument implements api.BoundCounter { | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator); | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: Logger, aggregator: Aggregator); | ||
add(value: number): void; | ||
@@ -42,3 +43,3 @@ } | ||
export declare class BoundValueRecorder extends BaseBoundInstrument implements api.BoundValueRecorder { | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator); | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: Logger, aggregator: Aggregator); | ||
record(value: number): void; | ||
@@ -50,4 +51,4 @@ } | ||
export declare class BoundObserver extends BaseBoundInstrument implements api.BoundBaseObserver { | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: api.Logger, aggregator: Aggregator); | ||
constructor(labels: api.Labels, disabled: boolean, valueType: api.ValueType, logger: Logger, aggregator: Aggregator); | ||
} | ||
//# sourceMappingURL=BoundInstrument.d.ts.map |
@@ -19,3 +19,3 @@ "use strict"; | ||
exports.BoundObserver = exports.BoundValueRecorder = exports.BoundUpDownCounter = exports.BoundCounter = exports.BaseBoundInstrument = void 0; | ||
const api = require("@opentelemetry/api"); | ||
const api = require("@opentelemetry/api-metrics"); | ||
/** | ||
@@ -22,0 +22,0 @@ * This class represent the base to BoundInstrument, which is responsible for generating |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -1,2 +0,3 @@ | ||
import { ValueType, HrTime, Labels } from '@opentelemetry/api'; | ||
import { HrTime } from '@opentelemetry/api'; | ||
import { Labels, ValueType } from '@opentelemetry/api-metrics'; | ||
import { ExportResult, InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +4,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { BatchObserver } from './BatchObserver'; |
@@ -19,16 +19,17 @@ "use strict"; | ||
exports.Meter = void 0; | ||
const api = require("@opentelemetry/api"); | ||
const api = require("@opentelemetry/api-metrics"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const resources_1 = require("@opentelemetry/resources"); | ||
const BatchObserver_1 = require("./BatchObserver"); | ||
const CounterMetric_1 = require("./CounterMetric"); | ||
const Controller_1 = require("./export/Controller"); | ||
const NoopExporter_1 = require("./export/NoopExporter"); | ||
const Processor_1 = require("./export/Processor"); | ||
const SumObserverMetric_1 = require("./SumObserverMetric"); | ||
const types_1 = require("./types"); | ||
const UpDownCounterMetric_1 = require("./UpDownCounterMetric"); | ||
const CounterMetric_1 = require("./CounterMetric"); | ||
const UpDownSumObserverMetric_1 = require("./UpDownSumObserverMetric"); | ||
const ValueObserverMetric_1 = require("./ValueObserverMetric"); | ||
const ValueRecorderMetric_1 = require("./ValueRecorderMetric"); | ||
const ValueObserverMetric_1 = require("./ValueObserverMetric"); | ||
const SumObserverMetric_1 = require("./SumObserverMetric"); | ||
const types_1 = require("./types"); | ||
const Processor_1 = require("./export/Processor"); | ||
const Controller_1 = require("./export/Controller"); | ||
const NoopExporter_1 = require("./export/NoopExporter"); | ||
const merge = require("lodash.merge"); | ||
/** | ||
@@ -41,3 +42,3 @@ * Meter is an implementation of the {@link Meter} interface. | ||
*/ | ||
constructor(instrumentationLibrary, config = types_1.DEFAULT_CONFIG) { | ||
constructor(instrumentationLibrary, config = {}) { | ||
var _a; | ||
@@ -48,9 +49,11 @@ this._batchObservers = []; | ||
this._shuttingDownPromise = Promise.resolve(); | ||
this._logger = config.logger || new core_1.ConsoleLogger(config.logLevel); | ||
this._processor = (_a = config.processor) !== null && _a !== void 0 ? _a : new Processor_1.UngroupedProcessor(); | ||
this._resource = config.resource || resources_1.Resource.createTelemetrySDKResource(); | ||
const mergedConfig = merge({}, types_1.DEFAULT_CONFIG, config); | ||
this._logger = mergedConfig.logger || new core_1.ConsoleLogger(config.logLevel); | ||
this._processor = (_a = mergedConfig.processor) !== null && _a !== void 0 ? _a : new Processor_1.UngroupedProcessor(); | ||
this._resource = | ||
mergedConfig.resource || resources_1.Resource.createTelemetrySDKResource(); | ||
this._instrumentationLibrary = instrumentationLibrary; | ||
// start the push controller | ||
const exporter = config.exporter || new NoopExporter_1.NoopExporter(); | ||
const interval = config.interval; | ||
const exporter = mergedConfig.exporter || new NoopExporter_1.NoopExporter(); | ||
const interval = mergedConfig.interval; | ||
this._controller = new Controller_1.PushController(this, exporter, interval); | ||
@@ -57,0 +60,0 @@ } |
@@ -1,2 +0,3 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import { Logger } from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
@@ -14,3 +15,3 @@ import { Meter } from '.'; | ||
readonly resource: Resource; | ||
readonly logger: api.Logger; | ||
readonly logger: Logger; | ||
constructor(config?: MeterConfig); | ||
@@ -17,0 +18,0 @@ /** |
@@ -23,2 +23,3 @@ "use strict"; | ||
const types_1 = require("./types"); | ||
const merge = require("lodash.merge"); | ||
/** | ||
@@ -28,3 +29,3 @@ * This class represents a meter provider which platform libraries can extend | ||
class MeterProvider { | ||
constructor(config = types_1.DEFAULT_CONFIG) { | ||
constructor(config = {}) { | ||
var _a, _b; | ||
@@ -34,5 +35,6 @@ this._meters = new Map(); | ||
this._isShutdown = false; | ||
this.logger = (_a = config.logger) !== null && _a !== void 0 ? _a : new core_1.ConsoleLogger(config.logLevel); | ||
this.resource = (_b = config.resource) !== null && _b !== void 0 ? _b : resources_1.Resource.createTelemetrySDKResource(); | ||
this._config = Object.assign({}, config, { | ||
const mergedConfig = merge({}, types_1.DEFAULT_CONFIG, config); | ||
this.logger = (_a = mergedConfig.logger) !== null && _a !== void 0 ? _a : new core_1.ConsoleLogger(mergedConfig.logLevel); | ||
this.resource = (_b = mergedConfig.resource) !== null && _b !== void 0 ? _b : resources_1.Resource.createTelemetrySDKResource(); | ||
this._config = Object.assign({}, mergedConfig, { | ||
logger: this.logger, | ||
@@ -47,4 +49,4 @@ resource: this.resource, | ||
*/ | ||
getMeter(name, version = '*', config) { | ||
const key = `${name}@${version}`; | ||
getMeter(name, version, config) { | ||
const key = `${name}@${version || ''}`; | ||
if (!this._meters.has(key)) { | ||
@@ -51,0 +53,0 @@ this._meters.set(key, new _1.Meter({ name, version }, config || this._config)); |
@@ -1,6 +0,7 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import { Logger } from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
import { BaseBoundInstrument } from './BoundInstrument'; | ||
import { MetricDescriptor, MetricKind, MetricRecord } from './export/types'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
/** This is a SDK implementation of {@link Metric} interface. */ | ||
@@ -15,3 +16,3 @@ export declare abstract class Metric<T extends BaseBoundInstrument> implements api.UnboundMetric<T> { | ||
protected readonly _valueType: api.ValueType; | ||
protected readonly _logger: api.Logger; | ||
protected readonly _logger: Logger; | ||
protected readonly _descriptor: MetricDescriptor; | ||
@@ -18,0 +19,0 @@ protected readonly _boundaries: number[] | undefined; |
@@ -19,4 +19,4 @@ "use strict"; | ||
*/ | ||
const api = require("@opentelemetry/api"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const api_1 = require("@opentelemetry/api"); | ||
const api = require("@opentelemetry/api-metrics"); | ||
const Utils_1 = require("./Utils"); | ||
@@ -38,3 +38,3 @@ /** This is a SDK implementation of {@link Metric} interface. */ | ||
: api.ValueType.DOUBLE; | ||
this._logger = (_a = _options.logger) !== null && _a !== void 0 ? _a : new core_1.NoopLogger(); | ||
this._logger = (_a = _options.logger) !== null && _a !== void 0 ? _a : new api_1.NoopLogger(); | ||
this._boundaries = _options.boundaries; | ||
@@ -41,0 +41,0 @@ this._descriptor = this._getMetricDescriptor(); |
@@ -1,2 +0,2 @@ | ||
import { ObserverResult as TypeObserverResult, Labels } from '@opentelemetry/api'; | ||
import { ObserverResult as TypeObserverResult, Labels } from '@opentelemetry/api-metrics'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Implementation of {@link TypeObserverResult} |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -0,10 +1,11 @@ | ||
import { Logger } from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { LogLevel } from '@opentelemetry/core'; | ||
import * as api from '@opentelemetry/api'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
import { Processor } from './export/Processor'; | ||
import { MetricExporter } from './export/types'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
/** MeterConfig provides an interface for configuring a Meter. */ | ||
export interface MeterConfig { | ||
/** User provided logger. */ | ||
logger?: api.Logger; | ||
logger?: Logger; | ||
/** level of logger. */ | ||
@@ -11,0 +12,0 @@ logLevel?: LogLevel; |
@@ -19,4 +19,4 @@ "use strict"; | ||
exports.DEFAULT_METRIC_OPTIONS = exports.DEFAULT_CONFIG = void 0; | ||
const api = require("@opentelemetry/api-metrics"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const api = require("@opentelemetry/api"); | ||
/** Default Meter configuration. */ | ||
@@ -23,0 +23,0 @@ exports.DEFAULT_CONFIG = { |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
@@ -3,0 +3,0 @@ import { InstrumentationLibrary } from '@opentelemetry/core'; |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -1,2 +0,2 @@ | ||
import { Labels } from '@opentelemetry/api'; | ||
import { Labels } from '@opentelemetry/api-metrics'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Type guard to remove nulls from arrays |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -1,2 +0,2 @@ | ||
import * as api from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api-metrics'; | ||
import { InstrumentationLibrary } from '@opentelemetry/core'; | ||
@@ -3,0 +3,0 @@ import { Resource } from '@opentelemetry/resources'; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.14.0"; | ||
export declare const VERSION = "0.15.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.14.0'; | ||
exports.VERSION = '0.15.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/metrics", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "OpenTelemetry metrics SDK", | ||
@@ -9,13 +9,11 @@ "main": "build/src/index.js", | ||
"scripts": { | ||
"compile": "tsc --build", | ||
"clean": "tsc --build --clean", | ||
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", | ||
"tdd": "npm run test -- --watch-extensions ts --watch", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", | ||
"clean": "rimraf build/*", | ||
"lint": "eslint . --ext .ts", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"precompile": "tsc --version", | ||
"version:update": "node ../../scripts/version-update.js", | ||
"compile": "npm run version:update && tsc -p .", | ||
"prepare": "npm run compile", | ||
"watch": "tsc -w" | ||
"version": "node ../../scripts/version-update.js", | ||
"watch": "tsc --build --watch" | ||
}, | ||
@@ -46,5 +44,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/lodash.merge": "4.6.6", | ||
"@types/mocha": "8.2.0", | ||
"@types/node": "14.14.12", | ||
"@types/sinon": "9.0.9", | ||
"@types/node": "14.14.20", | ||
"@types/sinon": "9.0.10", | ||
"codecov": "3.8.1", | ||
@@ -55,3 +54,3 @@ "gts": "2.0.2", | ||
"rimraf": "3.0.2", | ||
"sinon": "9.2.2", | ||
"sinon": "9.2.3", | ||
"ts-mocha": "8.0.0", | ||
@@ -62,7 +61,9 @@ "ts-node": "9.1.1", | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.14.0", | ||
"@opentelemetry/core": "^0.14.0", | ||
"@opentelemetry/resources": "^0.14.0" | ||
"@opentelemetry/api": "^0.15.0", | ||
"@opentelemetry/api-metrics": "^0.15.0", | ||
"@opentelemetry/core": "^0.15.0", | ||
"@opentelemetry/resources": "^0.15.0", | ||
"lodash.merge": "^4.6.2" | ||
}, | ||
"gitHead": "27a8d4530c56257c191468b073669909bf8892a1" | ||
"gitHead": "960b868f5b7686eabbf49190071b8463551e5d8f" | ||
} |
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
135460
2053
5
13
+ Addedlodash.merge@^4.6.2
+ Added@opentelemetry/api@0.15.0(transitive)
+ Added@opentelemetry/api-metrics@0.15.0(transitive)
+ Added@opentelemetry/context-base@0.15.0(transitive)
+ Added@opentelemetry/core@0.15.0(transitive)
+ Added@opentelemetry/resources@0.15.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
- Removed@opentelemetry/api@0.14.0(transitive)
- Removed@opentelemetry/context-base@0.14.0(transitive)
- Removed@opentelemetry/core@0.14.0(transitive)
- Removed@opentelemetry/resources@0.14.0(transitive)
Updated@opentelemetry/api@^0.15.0
Updated@opentelemetry/core@^0.15.0