@opentelemetry/sdk-metrics
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { AggregatorKind, } from './types'; | ||
import { AggregatorKind } from './types'; | ||
/** Basic aggregator for None which keeps no recorded value. */ | ||
@@ -19,0 +19,0 @@ var DropAggregator = /** @class */ (function () { |
@@ -32,3 +32,3 @@ /* | ||
}; | ||
import { AggregatorKind } from './types'; | ||
import { AggregatorKind, } from './types'; | ||
import { DataPointType } from '../export/MetricData'; | ||
@@ -48,3 +48,3 @@ import { InstrumentType } from '../InstrumentDescriptor'; | ||
min: Infinity, | ||
max: -Infinity | ||
max: -Infinity, | ||
}; | ||
@@ -141,5 +141,6 @@ } | ||
sum: previousValue.sum + deltaValue.sum, | ||
hasMinMax: this._recordMinMax && (previousValue.hasMinMax || deltaValue.hasMinMax), | ||
hasMinMax: this._recordMinMax && | ||
(previousValue.hasMinMax || deltaValue.hasMinMax), | ||
min: min, | ||
max: max | ||
max: max, | ||
}); | ||
@@ -168,3 +169,3 @@ }; | ||
min: Infinity, | ||
max: -Infinity | ||
max: -Infinity, | ||
}); | ||
@@ -181,5 +182,5 @@ }; | ||
// determine if instrument allows negative values. | ||
var allowsNegativeValues = (descriptor.type === InstrumentType.UP_DOWN_COUNTER) || | ||
(descriptor.type === InstrumentType.OBSERVABLE_GAUGE) || | ||
(descriptor.type === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER); | ||
var allowsNegativeValues = descriptor.type === InstrumentType.UP_DOWN_COUNTER || | ||
descriptor.type === InstrumentType.OBSERVABLE_GAUGE || | ||
descriptor.type === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER; | ||
return { | ||
@@ -194,6 +195,6 @@ attributes: attributes, | ||
buckets: pointValue.buckets, | ||
count: pointValue.count | ||
count: pointValue.count, | ||
}, | ||
}; | ||
}) | ||
}), | ||
}; | ||
@@ -200,0 +201,0 @@ }; |
@@ -32,3 +32,3 @@ /* | ||
}; | ||
import { AggregatorKind } from './types'; | ||
import { AggregatorKind, } from './types'; | ||
import { hrTime, hrTimeToMicroseconds } from '@opentelemetry/core'; | ||
@@ -72,3 +72,6 @@ import { DataPointType } from '../export/MetricData'; | ||
// nanoseconds may lose precisions. | ||
var latestAccumulation = hrTimeToMicroseconds(delta.sampleTime) >= hrTimeToMicroseconds(previous.sampleTime) ? delta : previous; | ||
var latestAccumulation = hrTimeToMicroseconds(delta.sampleTime) >= | ||
hrTimeToMicroseconds(previous.sampleTime) | ||
? delta | ||
: previous; | ||
return new LastValueAccumulation(previous.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime); | ||
@@ -84,3 +87,6 @@ }; | ||
// nanoseconds may lose precisions. | ||
var latestAccumulation = hrTimeToMicroseconds(current.sampleTime) >= hrTimeToMicroseconds(previous.sampleTime) ? current : previous; | ||
var latestAccumulation = hrTimeToMicroseconds(current.sampleTime) >= | ||
hrTimeToMicroseconds(previous.sampleTime) | ||
? current | ||
: previous; | ||
return new LastValueAccumulation(current.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime); | ||
@@ -101,3 +107,3 @@ }; | ||
}; | ||
}) | ||
}), | ||
}; | ||
@@ -104,0 +110,0 @@ }; |
@@ -32,3 +32,3 @@ /* | ||
}; | ||
import { AggregatorKind } from './types'; | ||
import { AggregatorKind, } from './types'; | ||
import { DataPointType } from '../export/MetricData'; | ||
@@ -90,3 +90,3 @@ var SumAccumulation = /** @class */ (function () { | ||
*/ | ||
if (this.monotonic && (prevPv > currPv)) { | ||
if (this.monotonic && prevPv > currPv) { | ||
return new SumAccumulation(current.startTime, this.monotonic, currPv, true); | ||
@@ -110,3 +110,3 @@ } | ||
}), | ||
isMonotonic: this.monotonic | ||
isMonotonic: this.monotonic, | ||
}; | ||
@@ -113,0 +113,0 @@ }; |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { isSpanContextValid, trace } from '@opentelemetry/api'; | ||
import { isSpanContextValid, trace, } from '@opentelemetry/api'; | ||
var ExemplarBucket = /** @class */ (function () { | ||
@@ -51,3 +51,3 @@ function ExemplarBucket() { | ||
spanId: this.spanId, | ||
traceId: this.traceId | ||
traceId: this.traceId, | ||
}; | ||
@@ -54,0 +54,0 @@ this.attributes = {}; |
@@ -45,2 +45,3 @@ /* | ||
SimpleFixedSizeExemplarReservoir.prototype.getRandomInt = function (min, max) { | ||
//[min, max) | ||
return Math.floor(Math.random() * (max - min) + min); | ||
@@ -47,0 +48,0 @@ }; |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api'; | ||
import { isSpanContextValid, trace, TraceFlags, } from '@opentelemetry/api'; | ||
var WithTraceExemplarFilter = /** @class */ (function () { | ||
@@ -19,0 +19,0 @@ function WithTraceExemplarFilter() { |
@@ -9,4 +9,4 @@ import { InstrumentType } from '../InstrumentDescriptor'; | ||
/** | ||
* Aggregation temporality selector based on metric instrument types. | ||
*/ | ||
* Aggregation temporality selector based on metric instrument types. | ||
*/ | ||
export declare type AggregationTemporalitySelector = (instrumentType: InstrumentType) => AggregationTemporality; | ||
@@ -13,0 +13,0 @@ export declare const DEFAULT_AGGREGATION_SELECTOR: AggregationSelector; |
@@ -6,4 +6,10 @@ import { ExportResult } from '@opentelemetry/core'; | ||
import { PushMetricExporter } from './MetricExporter'; | ||
import { AggregationTemporalitySelector } from './AggregationSelector'; | ||
interface ConsoleMetricExporterOptions { | ||
temporalitySelector?: AggregationTemporalitySelector; | ||
} | ||
export declare class ConsoleMetricExporter implements PushMetricExporter { | ||
protected _shutdown: boolean; | ||
protected _temporalitySelector: AggregationTemporalitySelector; | ||
constructor(options?: ConsoleMetricExporterOptions); | ||
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void; | ||
@@ -15,2 +21,3 @@ forceFlush(): Promise<void>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ConsoleMetricExporter.d.ts.map |
@@ -28,7 +28,10 @@ var __values = (this && this.__values) || function(o) { | ||
import { ExportResultCode } from '@opentelemetry/core'; | ||
import { AggregationTemporality } from './AggregationTemporality'; | ||
import { DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR, } from './AggregationSelector'; | ||
/* eslint-disable no-console */ | ||
var ConsoleMetricExporter = /** @class */ (function () { | ||
function ConsoleMetricExporter() { | ||
function ConsoleMetricExporter(options) { | ||
var _a; | ||
this._shutdown = false; | ||
this._temporalitySelector = | ||
(_a = options === null || options === void 0 ? void 0 : options.temporalitySelector) !== null && _a !== void 0 ? _a : DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
} | ||
@@ -47,3 +50,3 @@ ConsoleMetricExporter.prototype.export = function (metrics, resultCallback) { | ||
ConsoleMetricExporter.prototype.selectAggregationTemporality = function (_instrumentType) { | ||
return AggregationTemporality.CUMULATIVE; | ||
return this._temporalitySelector(_instrumentType); | ||
}; | ||
@@ -65,3 +68,3 @@ ConsoleMetricExporter.prototype.shutdown = function () { | ||
dataPointType: metric.dataPointType, | ||
dataPoints: metric.dataPoints | ||
dataPoints: metric.dataPoints, | ||
}); | ||
@@ -68,0 +71,0 @@ } |
@@ -54,3 +54,3 @@ /* | ||
import { callWithTimeout } from '../utils'; | ||
import { DEFAULT_AGGREGATION_SELECTOR, DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR } from './AggregationSelector'; | ||
import { DEFAULT_AGGREGATION_SELECTOR, DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR, } from './AggregationSelector'; | ||
/** | ||
@@ -66,4 +66,6 @@ * A registered reader of metrics that, when linked to a {@link MetricProducer}, offers global | ||
this._shutdown = false; | ||
this._aggregationSelector = (_a = options === null || options === void 0 ? void 0 : options.aggregationSelector) !== null && _a !== void 0 ? _a : DEFAULT_AGGREGATION_SELECTOR; | ||
this._aggregationTemporalitySelector = (_b = options === null || options === void 0 ? void 0 : options.aggregationTemporalitySelector) !== null && _b !== void 0 ? _b : DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
this._aggregationSelector = | ||
(_a = options === null || options === void 0 ? void 0 : options.aggregationSelector) !== null && _a !== void 0 ? _a : DEFAULT_AGGREGATION_SELECTOR; | ||
this._aggregationTemporalitySelector = | ||
(_b = options === null || options === void 0 ? void 0 : options.aggregationTemporalitySelector) !== null && _b !== void 0 ? _b : DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
} | ||
@@ -70,0 +72,0 @@ /** |
@@ -93,3 +93,3 @@ /* | ||
import * as api from '@opentelemetry/api'; | ||
import { internal, ExportResultCode, globalErrorHandler, unrefTimer } from '@opentelemetry/core'; | ||
import { internal, ExportResultCode, globalErrorHandler, unrefTimer, } from '@opentelemetry/core'; | ||
import { MetricReader } from './MetricReader'; | ||
@@ -107,8 +107,10 @@ import { callWithTimeout, TimeoutError } from '../utils'; | ||
aggregationSelector: (_a = options.exporter.selectAggregation) === null || _a === void 0 ? void 0 : _a.bind(options.exporter), | ||
aggregationTemporalitySelector: (_b = options.exporter.selectAggregationTemporality) === null || _b === void 0 ? void 0 : _b.bind(options.exporter) | ||
aggregationTemporalitySelector: (_b = options.exporter.selectAggregationTemporality) === null || _b === void 0 ? void 0 : _b.bind(options.exporter), | ||
}) || this; | ||
if (options.exportIntervalMillis !== undefined && options.exportIntervalMillis <= 0) { | ||
if (options.exportIntervalMillis !== undefined && | ||
options.exportIntervalMillis <= 0) { | ||
throw Error('exportIntervalMillis must be greater than 0'); | ||
} | ||
if (options.exportTimeoutMillis !== undefined && options.exportTimeoutMillis <= 0) { | ||
if (options.exportTimeoutMillis !== undefined && | ||
options.exportTimeoutMillis <= 0) { | ||
throw Error('exportTimeoutMillis must be greater than 0'); | ||
@@ -115,0 +117,0 @@ } |
@@ -1,15 +0,15 @@ | ||
export { Sum, LastValue, Histogram, } from './aggregator/types'; | ||
export { Sum, LastValue, Histogram } from './aggregator/types'; | ||
export { AggregationSelector, AggregationTemporalitySelector, } from './export/AggregationSelector'; | ||
export { AggregationTemporality, } from './export/AggregationTemporality'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { PushMetricExporter, } from './export/MetricExporter'; | ||
export { PushMetricExporter } from './export/MetricExporter'; | ||
export { MetricReader, MetricReaderOptions } from './export/MetricReader'; | ||
export { PeriodicExportingMetricReader, PeriodicExportingMetricReaderOptions, } from './export/PeriodicExportingMetricReader'; | ||
export { InMemoryMetricExporter, } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter, } from './export/ConsoleMetricExporter'; | ||
export { InstrumentDescriptor, InstrumentType, } from './InstrumentDescriptor'; | ||
export { MeterProvider, MeterProviderOptions, } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation } from './view/Aggregation'; | ||
export { View, ViewOptions, } from './view/View'; | ||
export { InMemoryMetricExporter } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter } from './export/ConsoleMetricExporter'; | ||
export { InstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; | ||
export { MeterProvider, MeterProviderOptions } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View, ViewOptions } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -16,13 +16,13 @@ /* | ||
*/ | ||
export { AggregationTemporality, } from './export/AggregationTemporality'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPointType, } from './export/MetricData'; | ||
export { MetricReader } from './export/MetricReader'; | ||
export { PeriodicExportingMetricReader, } from './export/PeriodicExportingMetricReader'; | ||
export { InMemoryMetricExporter, } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter, } from './export/ConsoleMetricExporter'; | ||
export { InstrumentType, } from './InstrumentDescriptor'; | ||
export { MeterProvider, } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation } from './view/Aggregation'; | ||
export { View, } from './view/View'; | ||
export { InMemoryMetricExporter } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter } from './export/ConsoleMetricExporter'; | ||
export { InstrumentType } from './InstrumentDescriptor'; | ||
export { MeterProvider } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -50,7 +50,7 @@ /* | ||
export function isDescriptorCompatibleWith(descriptor, otherDescriptor) { | ||
return descriptor.name === otherDescriptor.name | ||
&& descriptor.unit === otherDescriptor.unit | ||
&& descriptor.type === otherDescriptor.type | ||
&& descriptor.valueType === otherDescriptor.valueType; | ||
return (descriptor.name === otherDescriptor.name && | ||
descriptor.unit === otherDescriptor.unit && | ||
descriptor.type === otherDescriptor.type && | ||
descriptor.valueType === otherDescriptor.valueType); | ||
} | ||
//# sourceMappingURL=InstrumentDescriptor.js.map |
@@ -41,3 +41,4 @@ /* | ||
if (context === void 0) { context = contextApi.active(); } | ||
if (this._descriptor.valueType === ValueType.INT && !Number.isInteger(value)) { | ||
if (this._descriptor.valueType === ValueType.INT && | ||
!Number.isInteger(value)) { | ||
diag.warn("INT value type cannot accept a floating-point value for " + this._descriptor.name + ", ignoring the fractional digits."); | ||
@@ -44,0 +45,0 @@ value = Math.trunc(value); |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { createInstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; | ||
import { createInstrumentDescriptor, InstrumentType, } from './InstrumentDescriptor'; | ||
import { CounterInstrument, HistogramInstrument, ObservableCounterInstrument, ObservableGaugeInstrument, ObservableUpDownCounterInstrument, UpDownCounterInstrument, } from './Instruments'; | ||
@@ -19,0 +19,0 @@ /** |
@@ -75,3 +75,4 @@ /* | ||
this._shutdown = false; | ||
this._sharedState = new MeterProviderSharedState((_b = options === null || options === void 0 ? void 0 : options.resource) !== null && _b !== void 0 ? _b : Resource.empty()); | ||
var resource = Resource.default().merge((_b = options === null || options === void 0 ? void 0 : options.resource) !== null && _b !== void 0 ? _b : Resource.empty()); | ||
this._sharedState = new MeterProviderSharedState(resource); | ||
if ((options === null || options === void 0 ? void 0 : options.views) != null && options.views.length > 0) { | ||
@@ -104,5 +105,7 @@ try { | ||
} | ||
return this._sharedState | ||
.getMeterSharedState({ name: name, version: version, schemaUrl: options.schemaUrl }) | ||
.meter; | ||
return this._sharedState.getMeterSharedState({ | ||
name: name, | ||
version: version, | ||
schemaUrl: options.schemaUrl, | ||
}).meter; | ||
}; | ||
@@ -109,0 +112,0 @@ /** |
@@ -35,3 +35,4 @@ /* | ||
if (attributes === void 0) { attributes = {}; } | ||
if (this._descriptor.valueType === ValueType.INT && !Number.isInteger(value)) { | ||
if (this._descriptor.valueType === ValueType.INT && | ||
!Number.isInteger(value)) { | ||
diag.warn("INT value type cannot accept a floating-point value for " + this._descriptor.name + ", ignoring the fractional digits."); | ||
@@ -68,3 +69,4 @@ value = Math.trunc(value); | ||
} | ||
if (metric._descriptor.valueType === ValueType.INT && !Number.isInteger(value)) { | ||
if (metric._descriptor.valueType === ValueType.INT && | ||
!Number.isInteger(value)) { | ||
diag.warn("INT value type cannot accept a floating-point value for " + metric._descriptor.name + ", ignoring the fractional digits."); | ||
@@ -71,0 +73,0 @@ value = Math.trunc(value); |
@@ -68,3 +68,3 @@ /* | ||
}; | ||
import { createInstrumentDescriptorWithView } from '../InstrumentDescriptor'; | ||
import { createInstrumentDescriptorWithView, } from '../InstrumentDescriptor'; | ||
import { Meter } from '../Meter'; | ||
@@ -134,4 +134,3 @@ import { isNotNullish } from '../utils'; | ||
var views = this._meterProviderSharedState.viewRegistry.findViews(descriptor, this._instrumentationScope); | ||
var storages = views | ||
.map(function (view) { | ||
var storages = views.map(function (view) { | ||
var viewDescriptor = createInstrumentDescriptorWithView(view, descriptor); | ||
@@ -138,0 +137,0 @@ var compatibleStorage = _this.metricStorageRegistry.findOrUpdateCompatibleStorage(viewDescriptor); |
@@ -72,4 +72,5 @@ /* | ||
collectionTime = hrTime(); | ||
meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()) | ||
.map(function (meterSharedState) { return meterSharedState.collect(_this, collectionTime, options); }); | ||
meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()).map(function (meterSharedState) { | ||
return meterSharedState.collect(_this, collectionTime, options); | ||
}); | ||
return [4 /*yield*/, Promise.all(meterCollectionPromises)]; | ||
@@ -76,0 +77,0 @@ case 1: |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { createInstrumentDescriptor } from '../InstrumentDescriptor'; | ||
import { createInstrumentDescriptor, } from '../InstrumentDescriptor'; | ||
/** | ||
@@ -34,3 +34,3 @@ * Internal interface. | ||
valueType: this._instrumentDescriptor.valueType, | ||
unit: this._instrumentDescriptor.unit | ||
unit: this._instrumentDescriptor.unit, | ||
}); | ||
@@ -37,0 +37,0 @@ }; |
@@ -27,5 +27,5 @@ /* | ||
}; | ||
import { isDescriptorCompatibleWith } from '../InstrumentDescriptor'; | ||
import { isDescriptorCompatibleWith, } from '../InstrumentDescriptor'; | ||
import * as api from '@opentelemetry/api'; | ||
import { getConflictResolutionRecipe, getIncompatibilityDetails } from '../view/RegistrationConflicts'; | ||
import { getConflictResolutionRecipe, getIncompatibilityDetails, } from '../view/RegistrationConflicts'; | ||
/** | ||
@@ -101,3 +101,3 @@ * Internal class for storing {@link MetricStorage} | ||
} | ||
var storages = this._sharedRegistry.get(expectedDescriptor.name); | ||
var storages = storageMap.get(expectedDescriptor.name); | ||
if (storages === undefined) { | ||
@@ -129,3 +129,4 @@ return null; | ||
if (existingDescriptor.description !== expectedDescriptor.description) { | ||
if (expectedDescriptor.description.length > existingDescriptor.description.length) { | ||
if (expectedDescriptor.description.length > | ||
existingDescriptor.description.length) { | ||
existingStorage.updateDescription(expectedDescriptor.description); | ||
@@ -132,0 +133,0 @@ } |
@@ -77,6 +77,6 @@ /* | ||
}; | ||
import { diag } from '@opentelemetry/api'; | ||
import { diag, } from '@opentelemetry/api'; | ||
import { isObservableInstrument } from '../Instruments'; | ||
import { BatchObservableResultImpl, ObservableResultImpl } from '../ObservableResult'; | ||
import { callWithTimeout, PromiseAllSettled, isPromiseAllSettledRejectionResult, setEquals } from '../utils'; | ||
import { BatchObservableResultImpl, ObservableResultImpl, } from '../ObservableResult'; | ||
import { callWithTimeout, PromiseAllSettled, isPromiseAllSettledRejectionResult, setEquals, } from '../utils'; | ||
/** | ||
@@ -143,3 +143,4 @@ * An internal interface for managing ObservableCallbacks. | ||
results = _a.sent(); | ||
rejections = results.filter(isPromiseAllSettledRejectionResult) | ||
rejections = results | ||
.filter(isPromiseAllSettledRejectionResult) | ||
.map(function (it) { return it.reason; }); | ||
@@ -153,4 +154,3 @@ return [2 /*return*/, rejections]; | ||
var _this = this; | ||
return this._callbacks | ||
.map(function (_a) { | ||
return this._callbacks.map(function (_a) { | ||
var callback = _a.callback, instrument = _a.instrument; | ||
@@ -181,4 +181,3 @@ return __awaiter(_this, void 0, void 0, function () { | ||
var _this = this; | ||
return this._batchCallbacks | ||
.map(function (_a) { | ||
return this._batchCallbacks.map(function (_a) { | ||
var callback = _a.callback, instruments = _a.instruments; | ||
@@ -220,3 +219,4 @@ return __awaiter(_this, void 0, void 0, function () { | ||
return this._batchCallbacks.findIndex(function (record) { | ||
return record.callback === callback && setEquals(record.instruments, instruments); | ||
return (record.callback === callback && | ||
setEquals(record.instruments, instruments)); | ||
}); | ||
@@ -223,0 +223,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.8.0"; | ||
export declare const VERSION = "1.9.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '1.8.0'; | ||
export var VERSION = '1.9.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -32,3 +32,3 @@ /* | ||
import * as api from '@opentelemetry/api'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator } from '../aggregator'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, } from '../aggregator'; | ||
import { InstrumentType } from '../InstrumentDescriptor'; | ||
@@ -35,0 +35,0 @@ /** |
@@ -71,4 +71,8 @@ /* | ||
Object.keys(incoming) | ||
.filter(function (attributeName) { return _this._allowedAttributeNames.includes(attributeName); }) | ||
.forEach(function (attributeName) { return filteredAttributes[attributeName] = incoming[attributeName]; }); | ||
.filter(function (attributeName) { | ||
return _this._allowedAttributeNames.includes(attributeName); | ||
}) | ||
.forEach(function (attributeName) { | ||
return (filteredAttributes[attributeName] = incoming[attributeName]); | ||
}); | ||
return filteredAttributes; | ||
@@ -79,3 +83,3 @@ }; | ||
export { FilteringAttributesProcessor }; | ||
var NOOP = new NoopAttributesProcessor; | ||
var NOOP = new NoopAttributesProcessor(); | ||
//# sourceMappingURL=AttributesProcessor.js.map |
@@ -41,3 +41,3 @@ /* | ||
name: otherDescriptor.name, | ||
type: otherDescriptor.type | ||
type: otherDescriptor.type, | ||
}; | ||
@@ -50,3 +50,3 @@ var selectorString = JSON.stringify(selector); | ||
name: otherDescriptor.name, | ||
type: otherDescriptor.type | ||
type: otherDescriptor.type, | ||
}; | ||
@@ -53,0 +53,0 @@ var selectorString = JSON.stringify(selector); |
@@ -17,3 +17,3 @@ /* | ||
import { PatternPredicate } from './Predicate'; | ||
import { AttributesProcessor, FilteringAttributesProcessor } from './AttributesProcessor'; | ||
import { AttributesProcessor, FilteringAttributesProcessor, } from './AttributesProcessor'; | ||
import { InstrumentSelector } from './InstrumentSelector'; | ||
@@ -113,3 +113,3 @@ import { MeterSelector } from './MeterSelector'; | ||
version: viewOptions.meterVersion, | ||
schemaUrl: viewOptions.meterSchemaUrl | ||
schemaUrl: viewOptions.meterSchemaUrl, | ||
}); | ||
@@ -116,0 +116,0 @@ } |
@@ -25,6 +25,5 @@ /* | ||
var _this = this; | ||
var views = this._registeredViews | ||
.filter(function (registeredView) { | ||
return _this._matchInstrument(registeredView.instrumentSelector, instrument) && | ||
_this._matchMeter(registeredView.meterSelector, meter); | ||
var views = this._registeredViews.filter(function (registeredView) { | ||
return (_this._matchInstrument(registeredView.instrumentSelector, instrument) && | ||
_this._matchMeter(registeredView.meterSelector, meter)); | ||
}); | ||
@@ -34,9 +33,12 @@ return views; | ||
ViewRegistry.prototype._matchInstrument = function (selector, instrument) { | ||
return (selector.getType() === undefined || instrument.type === selector.getType()) && | ||
selector.getNameFilter().match(instrument.name); | ||
return ((selector.getType() === undefined || | ||
instrument.type === selector.getType()) && | ||
selector.getNameFilter().match(instrument.name)); | ||
}; | ||
ViewRegistry.prototype._matchMeter = function (selector, meter) { | ||
return selector.getNameFilter().match(meter.name) && | ||
(meter.version === undefined || selector.getVersionFilter().match(meter.version)) && | ||
(meter.schemaUrl === undefined || selector.getSchemaUrlFilter().match(meter.schemaUrl)); | ||
return (selector.getNameFilter().match(meter.name) && | ||
(meter.version === undefined || | ||
selector.getVersionFilter().match(meter.version)) && | ||
(meter.schemaUrl === undefined || | ||
selector.getSchemaUrlFilter().match(meter.schemaUrl))); | ||
}; | ||
@@ -43,0 +45,0 @@ return ViewRegistry; |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { AggregatorKind, } from './types'; | ||
import { AggregatorKind } from './types'; | ||
/** Basic aggregator for None which keeps no recorded value. */ | ||
@@ -19,0 +19,0 @@ export class DropAggregator { |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { AggregatorKind } from './types'; | ||
import { AggregatorKind, } from './types'; | ||
import { DataPointType } from '../export/MetricData'; | ||
@@ -32,3 +32,3 @@ import { InstrumentType } from '../InstrumentDescriptor'; | ||
min: Infinity, | ||
max: -Infinity | ||
max: -Infinity, | ||
}; | ||
@@ -121,5 +121,6 @@ } | ||
sum: previousValue.sum + deltaValue.sum, | ||
hasMinMax: this._recordMinMax && (previousValue.hasMinMax || deltaValue.hasMinMax), | ||
hasMinMax: this._recordMinMax && | ||
(previousValue.hasMinMax || deltaValue.hasMinMax), | ||
min: min, | ||
max: max | ||
max: max, | ||
}); | ||
@@ -148,3 +149,3 @@ } | ||
min: Infinity, | ||
max: -Infinity | ||
max: -Infinity, | ||
}); | ||
@@ -160,5 +161,5 @@ } | ||
// determine if instrument allows negative values. | ||
const allowsNegativeValues = (descriptor.type === InstrumentType.UP_DOWN_COUNTER) || | ||
(descriptor.type === InstrumentType.OBSERVABLE_GAUGE) || | ||
(descriptor.type === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER); | ||
const allowsNegativeValues = descriptor.type === InstrumentType.UP_DOWN_COUNTER || | ||
descriptor.type === InstrumentType.OBSERVABLE_GAUGE || | ||
descriptor.type === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER; | ||
return { | ||
@@ -173,6 +174,6 @@ attributes, | ||
buckets: pointValue.buckets, | ||
count: pointValue.count | ||
count: pointValue.count, | ||
}, | ||
}; | ||
}) | ||
}), | ||
}; | ||
@@ -179,0 +180,0 @@ } |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { AggregatorKind } from './types'; | ||
import { AggregatorKind, } from './types'; | ||
import { hrTime, hrTimeToMicroseconds } from '@opentelemetry/core'; | ||
@@ -52,3 +52,6 @@ import { DataPointType } from '../export/MetricData'; | ||
// nanoseconds may lose precisions. | ||
const latestAccumulation = hrTimeToMicroseconds(delta.sampleTime) >= hrTimeToMicroseconds(previous.sampleTime) ? delta : previous; | ||
const latestAccumulation = hrTimeToMicroseconds(delta.sampleTime) >= | ||
hrTimeToMicroseconds(previous.sampleTime) | ||
? delta | ||
: previous; | ||
return new LastValueAccumulation(previous.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime); | ||
@@ -64,3 +67,6 @@ } | ||
// nanoseconds may lose precisions. | ||
const latestAccumulation = hrTimeToMicroseconds(current.sampleTime) >= hrTimeToMicroseconds(previous.sampleTime) ? current : previous; | ||
const latestAccumulation = hrTimeToMicroseconds(current.sampleTime) >= | ||
hrTimeToMicroseconds(previous.sampleTime) | ||
? current | ||
: previous; | ||
return new LastValueAccumulation(current.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime); | ||
@@ -80,3 +86,3 @@ } | ||
}; | ||
}) | ||
}), | ||
}; | ||
@@ -83,0 +89,0 @@ } |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { AggregatorKind } from './types'; | ||
import { AggregatorKind, } from './types'; | ||
import { DataPointType } from '../export/MetricData'; | ||
@@ -70,3 +70,3 @@ export class SumAccumulation { | ||
*/ | ||
if (this.monotonic && (prevPv > currPv)) { | ||
if (this.monotonic && prevPv > currPv) { | ||
return new SumAccumulation(current.startTime, this.monotonic, currPv, true); | ||
@@ -89,3 +89,3 @@ } | ||
}), | ||
isMonotonic: this.monotonic | ||
isMonotonic: this.monotonic, | ||
}; | ||
@@ -92,0 +92,0 @@ } |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { isSpanContextValid, trace } from '@opentelemetry/api'; | ||
import { isSpanContextValid, trace, } from '@opentelemetry/api'; | ||
class ExemplarBucket { | ||
@@ -51,3 +51,3 @@ constructor() { | ||
spanId: this.spanId, | ||
traceId: this.traceId | ||
traceId: this.traceId, | ||
}; | ||
@@ -54,0 +54,0 @@ this.attributes = {}; |
@@ -28,2 +28,3 @@ /* | ||
getRandomInt(min, max) { | ||
//[min, max) | ||
return Math.floor(Math.random() * (max - min) + min); | ||
@@ -30,0 +31,0 @@ } |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api'; | ||
import { isSpanContextValid, trace, TraceFlags, } from '@opentelemetry/api'; | ||
export class WithTraceExemplarFilter { | ||
@@ -19,0 +19,0 @@ shouldSample(value, timestamp, attributes, ctx) { |
@@ -9,4 +9,4 @@ import { InstrumentType } from '../InstrumentDescriptor'; | ||
/** | ||
* Aggregation temporality selector based on metric instrument types. | ||
*/ | ||
* Aggregation temporality selector based on metric instrument types. | ||
*/ | ||
export declare type AggregationTemporalitySelector = (instrumentType: InstrumentType) => AggregationTemporality; | ||
@@ -13,0 +13,0 @@ export declare const DEFAULT_AGGREGATION_SELECTOR: AggregationSelector; |
@@ -6,4 +6,10 @@ import { ExportResult } from '@opentelemetry/core'; | ||
import { PushMetricExporter } from './MetricExporter'; | ||
import { AggregationTemporalitySelector } from './AggregationSelector'; | ||
interface ConsoleMetricExporterOptions { | ||
temporalitySelector?: AggregationTemporalitySelector; | ||
} | ||
export declare class ConsoleMetricExporter implements PushMetricExporter { | ||
protected _shutdown: boolean; | ||
protected _temporalitySelector: AggregationTemporalitySelector; | ||
constructor(options?: ConsoleMetricExporterOptions); | ||
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void; | ||
@@ -15,2 +21,3 @@ forceFlush(): Promise<void>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ConsoleMetricExporter.d.ts.map |
@@ -17,7 +17,10 @@ /* | ||
import { ExportResultCode } from '@opentelemetry/core'; | ||
import { AggregationTemporality } from './AggregationTemporality'; | ||
import { DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR, } from './AggregationSelector'; | ||
/* eslint-disable no-console */ | ||
export class ConsoleMetricExporter { | ||
constructor() { | ||
constructor(options) { | ||
var _a; | ||
this._shutdown = false; | ||
this._temporalitySelector = | ||
(_a = options === null || options === void 0 ? void 0 : options.temporalitySelector) !== null && _a !== void 0 ? _a : DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
} | ||
@@ -36,3 +39,3 @@ export(metrics, resultCallback) { | ||
selectAggregationTemporality(_instrumentType) { | ||
return AggregationTemporality.CUMULATIVE; | ||
return this._temporalitySelector(_instrumentType); | ||
} | ||
@@ -49,3 +52,3 @@ shutdown() { | ||
dataPointType: metric.dataPointType, | ||
dataPoints: metric.dataPoints | ||
dataPoints: metric.dataPoints, | ||
}); | ||
@@ -52,0 +55,0 @@ } |
@@ -18,3 +18,3 @@ /* | ||
import { callWithTimeout } from '../utils'; | ||
import { DEFAULT_AGGREGATION_SELECTOR, DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR } from './AggregationSelector'; | ||
import { DEFAULT_AGGREGATION_SELECTOR, DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR, } from './AggregationSelector'; | ||
/** | ||
@@ -30,4 +30,6 @@ * A registered reader of metrics that, when linked to a {@link MetricProducer}, offers global | ||
this._shutdown = false; | ||
this._aggregationSelector = (_a = options === null || options === void 0 ? void 0 : options.aggregationSelector) !== null && _a !== void 0 ? _a : DEFAULT_AGGREGATION_SELECTOR; | ||
this._aggregationTemporalitySelector = (_b = options === null || options === void 0 ? void 0 : options.aggregationTemporalitySelector) !== null && _b !== void 0 ? _b : DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
this._aggregationSelector = | ||
(_a = options === null || options === void 0 ? void 0 : options.aggregationSelector) !== null && _a !== void 0 ? _a : DEFAULT_AGGREGATION_SELECTOR; | ||
this._aggregationTemporalitySelector = | ||
(_b = options === null || options === void 0 ? void 0 : options.aggregationTemporalitySelector) !== null && _b !== void 0 ? _b : DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
} | ||
@@ -34,0 +36,0 @@ /** |
@@ -17,3 +17,3 @@ /* | ||
import * as api from '@opentelemetry/api'; | ||
import { internal, ExportResultCode, globalErrorHandler, unrefTimer } from '@opentelemetry/core'; | ||
import { internal, ExportResultCode, globalErrorHandler, unrefTimer, } from '@opentelemetry/core'; | ||
import { MetricReader } from './MetricReader'; | ||
@@ -30,8 +30,10 @@ import { callWithTimeout, TimeoutError } from '../utils'; | ||
aggregationSelector: (_a = options.exporter.selectAggregation) === null || _a === void 0 ? void 0 : _a.bind(options.exporter), | ||
aggregationTemporalitySelector: (_b = options.exporter.selectAggregationTemporality) === null || _b === void 0 ? void 0 : _b.bind(options.exporter) | ||
aggregationTemporalitySelector: (_b = options.exporter.selectAggregationTemporality) === null || _b === void 0 ? void 0 : _b.bind(options.exporter), | ||
}); | ||
if (options.exportIntervalMillis !== undefined && options.exportIntervalMillis <= 0) { | ||
if (options.exportIntervalMillis !== undefined && | ||
options.exportIntervalMillis <= 0) { | ||
throw Error('exportIntervalMillis must be greater than 0'); | ||
} | ||
if (options.exportTimeoutMillis !== undefined && options.exportTimeoutMillis <= 0) { | ||
if (options.exportTimeoutMillis !== undefined && | ||
options.exportTimeoutMillis <= 0) { | ||
throw Error('exportTimeoutMillis must be greater than 0'); | ||
@@ -38,0 +40,0 @@ } |
@@ -1,15 +0,15 @@ | ||
export { Sum, LastValue, Histogram, } from './aggregator/types'; | ||
export { Sum, LastValue, Histogram } from './aggregator/types'; | ||
export { AggregationSelector, AggregationTemporalitySelector, } from './export/AggregationSelector'; | ||
export { AggregationTemporality, } from './export/AggregationTemporality'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { PushMetricExporter, } from './export/MetricExporter'; | ||
export { PushMetricExporter } from './export/MetricExporter'; | ||
export { MetricReader, MetricReaderOptions } from './export/MetricReader'; | ||
export { PeriodicExportingMetricReader, PeriodicExportingMetricReaderOptions, } from './export/PeriodicExportingMetricReader'; | ||
export { InMemoryMetricExporter, } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter, } from './export/ConsoleMetricExporter'; | ||
export { InstrumentDescriptor, InstrumentType, } from './InstrumentDescriptor'; | ||
export { MeterProvider, MeterProviderOptions, } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation } from './view/Aggregation'; | ||
export { View, ViewOptions, } from './view/View'; | ||
export { InMemoryMetricExporter } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter } from './export/ConsoleMetricExporter'; | ||
export { InstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; | ||
export { MeterProvider, MeterProviderOptions } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View, ViewOptions } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -16,13 +16,13 @@ /* | ||
*/ | ||
export { AggregationTemporality, } from './export/AggregationTemporality'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPointType, } from './export/MetricData'; | ||
export { MetricReader } from './export/MetricReader'; | ||
export { PeriodicExportingMetricReader, } from './export/PeriodicExportingMetricReader'; | ||
export { InMemoryMetricExporter, } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter, } from './export/ConsoleMetricExporter'; | ||
export { InstrumentType, } from './InstrumentDescriptor'; | ||
export { MeterProvider, } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation } from './view/Aggregation'; | ||
export { View, } from './view/View'; | ||
export { InMemoryMetricExporter } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter } from './export/ConsoleMetricExporter'; | ||
export { InstrumentType } from './InstrumentDescriptor'; | ||
export { MeterProvider } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -50,7 +50,7 @@ /* | ||
export function isDescriptorCompatibleWith(descriptor, otherDescriptor) { | ||
return descriptor.name === otherDescriptor.name | ||
&& descriptor.unit === otherDescriptor.unit | ||
&& descriptor.type === otherDescriptor.type | ||
&& descriptor.valueType === otherDescriptor.valueType; | ||
return (descriptor.name === otherDescriptor.name && | ||
descriptor.unit === otherDescriptor.unit && | ||
descriptor.type === otherDescriptor.type && | ||
descriptor.valueType === otherDescriptor.valueType); | ||
} | ||
//# sourceMappingURL=InstrumentDescriptor.js.map |
@@ -24,3 +24,4 @@ /* | ||
_record(value, attributes = {}, context = contextApi.active()) { | ||
if (this._descriptor.valueType === ValueType.INT && !Number.isInteger(value)) { | ||
if (this._descriptor.valueType === ValueType.INT && | ||
!Number.isInteger(value)) { | ||
diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`); | ||
@@ -27,0 +28,0 @@ value = Math.trunc(value); |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { createInstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; | ||
import { createInstrumentDescriptor, InstrumentType, } from './InstrumentDescriptor'; | ||
import { CounterInstrument, HistogramInstrument, ObservableCounterInstrument, ObservableGaugeInstrument, ObservableUpDownCounterInstrument, UpDownCounterInstrument, } from './Instruments'; | ||
@@ -19,0 +19,0 @@ /** |
@@ -27,3 +27,4 @@ /* | ||
this._shutdown = false; | ||
this._sharedState = new MeterProviderSharedState((_a = options === null || options === void 0 ? void 0 : options.resource) !== null && _a !== void 0 ? _a : Resource.empty()); | ||
const resource = Resource.default().merge((_a = options === null || options === void 0 ? void 0 : options.resource) !== null && _a !== void 0 ? _a : Resource.empty()); | ||
this._sharedState = new MeterProviderSharedState(resource); | ||
if ((options === null || options === void 0 ? void 0 : options.views) != null && options.views.length > 0) { | ||
@@ -44,5 +45,7 @@ for (const view of options.views) { | ||
} | ||
return this._sharedState | ||
.getMeterSharedState({ name, version, schemaUrl: options.schemaUrl }) | ||
.meter; | ||
return this._sharedState.getMeterSharedState({ | ||
name, | ||
version, | ||
schemaUrl: options.schemaUrl, | ||
}).meter; | ||
} | ||
@@ -49,0 +52,0 @@ /** |
@@ -34,3 +34,4 @@ /* | ||
observe(value, attributes = {}) { | ||
if (this._descriptor.valueType === ValueType.INT && !Number.isInteger(value)) { | ||
if (this._descriptor.valueType === ValueType.INT && | ||
!Number.isInteger(value)) { | ||
diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`); | ||
@@ -64,3 +65,4 @@ value = Math.trunc(value); | ||
} | ||
if (metric._descriptor.valueType === ValueType.INT && !Number.isInteger(value)) { | ||
if (metric._descriptor.valueType === ValueType.INT && | ||
!Number.isInteger(value)) { | ||
diag.warn(`INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.`); | ||
@@ -67,0 +69,0 @@ value = Math.trunc(value); |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { createInstrumentDescriptorWithView } from '../InstrumentDescriptor'; | ||
import { createInstrumentDescriptorWithView, } from '../InstrumentDescriptor'; | ||
import { Meter } from '../Meter'; | ||
@@ -75,4 +75,3 @@ import { isNotNullish } from '../utils'; | ||
const views = this._meterProviderSharedState.viewRegistry.findViews(descriptor, this._instrumentationScope); | ||
let storages = views | ||
.map(view => { | ||
let storages = views.map(view => { | ||
const viewDescriptor = createInstrumentDescriptorWithView(view, descriptor); | ||
@@ -79,0 +78,0 @@ const compatibleStorage = this.metricStorageRegistry.findOrUpdateCompatibleStorage(viewDescriptor); |
@@ -30,4 +30,3 @@ /* | ||
const collectionTime = hrTime(); | ||
const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()) | ||
.map(meterSharedState => meterSharedState.collect(this, collectionTime, options)); | ||
const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()).map(meterSharedState => meterSharedState.collect(this, collectionTime, options)); | ||
const result = await Promise.all(meterCollectionPromises); | ||
@@ -34,0 +33,0 @@ return { |
@@ -16,3 +16,3 @@ /* | ||
*/ | ||
import { createInstrumentDescriptor } from '../InstrumentDescriptor'; | ||
import { createInstrumentDescriptor, } from '../InstrumentDescriptor'; | ||
/** | ||
@@ -34,3 +34,3 @@ * Internal interface. | ||
valueType: this._instrumentDescriptor.valueType, | ||
unit: this._instrumentDescriptor.unit | ||
unit: this._instrumentDescriptor.unit, | ||
}); | ||
@@ -37,0 +37,0 @@ } |
@@ -16,5 +16,5 @@ /* | ||
*/ | ||
import { isDescriptorCompatibleWith } from '../InstrumentDescriptor'; | ||
import { isDescriptorCompatibleWith, } from '../InstrumentDescriptor'; | ||
import * as api from '@opentelemetry/api'; | ||
import { getConflictResolutionRecipe, getIncompatibilityDetails } from '../view/RegistrationConflicts'; | ||
import { getConflictResolutionRecipe, getIncompatibilityDetails, } from '../view/RegistrationConflicts'; | ||
/** | ||
@@ -69,3 +69,3 @@ * Internal class for storing {@link MetricStorage} | ||
} | ||
const storages = this._sharedRegistry.get(expectedDescriptor.name); | ||
const storages = storageMap.get(expectedDescriptor.name); | ||
if (storages === undefined) { | ||
@@ -94,3 +94,4 @@ return null; | ||
if (existingDescriptor.description !== expectedDescriptor.description) { | ||
if (expectedDescriptor.description.length > existingDescriptor.description.length) { | ||
if (expectedDescriptor.description.length > | ||
existingDescriptor.description.length) { | ||
existingStorage.updateDescription(expectedDescriptor.description); | ||
@@ -97,0 +98,0 @@ } |
@@ -16,6 +16,6 @@ /* | ||
*/ | ||
import { diag } from '@opentelemetry/api'; | ||
import { diag, } from '@opentelemetry/api'; | ||
import { isObservableInstrument } from '../Instruments'; | ||
import { BatchObservableResultImpl, ObservableResultImpl } from '../ObservableResult'; | ||
import { callWithTimeout, PromiseAllSettled, isPromiseAllSettledRejectionResult, setEquals } from '../utils'; | ||
import { BatchObservableResultImpl, ObservableResultImpl, } from '../ObservableResult'; | ||
import { callWithTimeout, PromiseAllSettled, isPromiseAllSettledRejectionResult, setEquals, } from '../utils'; | ||
/** | ||
@@ -74,4 +74,8 @@ * An internal interface for managing ObservableCallbacks. | ||
const batchCallbackFutures = this._observeBatchCallbacks(collectionTime, timeoutMillis); | ||
const results = await PromiseAllSettled([...callbackFutures, ...batchCallbackFutures]); | ||
const rejections = results.filter(isPromiseAllSettledRejectionResult) | ||
const results = await PromiseAllSettled([ | ||
...callbackFutures, | ||
...batchCallbackFutures, | ||
]); | ||
const rejections = results | ||
.filter(isPromiseAllSettledRejectionResult) | ||
.map(it => it.reason); | ||
@@ -81,4 +85,3 @@ return rejections; | ||
_observeCallbacks(observationTime, timeoutMillis) { | ||
return this._callbacks | ||
.map(async ({ callback, instrument }) => { | ||
return this._callbacks.map(async ({ callback, instrument }) => { | ||
const observableResult = new ObservableResultImpl(instrument._descriptor); | ||
@@ -96,4 +99,3 @@ let callPromise = Promise.resolve(callback(observableResult)); | ||
_observeBatchCallbacks(observationTime, timeoutMillis) { | ||
return this._batchCallbacks | ||
.map(async ({ callback, instruments }) => { | ||
return this._batchCallbacks.map(async ({ callback, instruments }) => { | ||
const observableResult = new BatchObservableResultImpl(); | ||
@@ -123,3 +125,4 @@ let callPromise = Promise.resolve(callback(observableResult)); | ||
return this._batchCallbacks.findIndex(record => { | ||
return record.callback === callback && setEquals(record.instruments, instruments); | ||
return (record.callback === callback && | ||
setEquals(record.instruments, instruments)); | ||
}); | ||
@@ -126,0 +129,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.8.0"; | ||
export declare const VERSION = "1.9.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '1.8.0'; | ||
export const VERSION = '1.9.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -17,3 +17,3 @@ /* | ||
import * as api from '@opentelemetry/api'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator } from '../aggregator'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, } from '../aggregator'; | ||
import { InstrumentType } from '../InstrumentDescriptor'; | ||
@@ -20,0 +20,0 @@ /** |
@@ -44,7 +44,7 @@ /* | ||
.filter(attributeName => this._allowedAttributeNames.includes(attributeName)) | ||
.forEach(attributeName => filteredAttributes[attributeName] = incoming[attributeName]); | ||
.forEach(attributeName => (filteredAttributes[attributeName] = incoming[attributeName])); | ||
return filteredAttributes; | ||
} | ||
} | ||
const NOOP = new NoopAttributesProcessor; | ||
const NOOP = new NoopAttributesProcessor(); | ||
//# sourceMappingURL=AttributesProcessor.js.map |
@@ -41,3 +41,3 @@ /* | ||
name: otherDescriptor.name, | ||
type: otherDescriptor.type | ||
type: otherDescriptor.type, | ||
}; | ||
@@ -50,3 +50,3 @@ const selectorString = JSON.stringify(selector); | ||
name: otherDescriptor.name, | ||
type: otherDescriptor.type | ||
type: otherDescriptor.type, | ||
}; | ||
@@ -53,0 +53,0 @@ const selectorString = JSON.stringify(selector); |
@@ -17,3 +17,3 @@ /* | ||
import { PatternPredicate } from './Predicate'; | ||
import { AttributesProcessor, FilteringAttributesProcessor } from './AttributesProcessor'; | ||
import { AttributesProcessor, FilteringAttributesProcessor, } from './AttributesProcessor'; | ||
import { InstrumentSelector } from './InstrumentSelector'; | ||
@@ -113,3 +113,3 @@ import { MeterSelector } from './MeterSelector'; | ||
version: viewOptions.meterVersion, | ||
schemaUrl: viewOptions.meterSchemaUrl | ||
schemaUrl: viewOptions.meterSchemaUrl, | ||
}); | ||
@@ -116,0 +116,0 @@ } |
@@ -24,6 +24,5 @@ /* | ||
findViews(instrument, meter) { | ||
const views = this._registeredViews | ||
.filter(registeredView => { | ||
return this._matchInstrument(registeredView.instrumentSelector, instrument) && | ||
this._matchMeter(registeredView.meterSelector, meter); | ||
const views = this._registeredViews.filter(registeredView => { | ||
return (this._matchInstrument(registeredView.instrumentSelector, instrument) && | ||
this._matchMeter(registeredView.meterSelector, meter)); | ||
}); | ||
@@ -33,11 +32,14 @@ return views; | ||
_matchInstrument(selector, instrument) { | ||
return (selector.getType() === undefined || instrument.type === selector.getType()) && | ||
selector.getNameFilter().match(instrument.name); | ||
return ((selector.getType() === undefined || | ||
instrument.type === selector.getType()) && | ||
selector.getNameFilter().match(instrument.name)); | ||
} | ||
_matchMeter(selector, meter) { | ||
return selector.getNameFilter().match(meter.name) && | ||
(meter.version === undefined || selector.getVersionFilter().match(meter.version)) && | ||
(meter.schemaUrl === undefined || selector.getSchemaUrlFilter().match(meter.schemaUrl)); | ||
return (selector.getNameFilter().match(meter.name) && | ||
(meter.version === undefined || | ||
selector.getVersionFilter().match(meter.version)) && | ||
(meter.schemaUrl === undefined || | ||
selector.getSchemaUrlFilter().match(meter.schemaUrl))); | ||
} | ||
} | ||
//# sourceMappingURL=ViewRegistry.js.map |
@@ -34,3 +34,3 @@ "use strict"; | ||
min: Infinity, | ||
max: -Infinity | ||
max: -Infinity, | ||
}; | ||
@@ -124,5 +124,6 @@ } | ||
sum: previousValue.sum + deltaValue.sum, | ||
hasMinMax: this._recordMinMax && (previousValue.hasMinMax || deltaValue.hasMinMax), | ||
hasMinMax: this._recordMinMax && | ||
(previousValue.hasMinMax || deltaValue.hasMinMax), | ||
min: min, | ||
max: max | ||
max: max, | ||
}); | ||
@@ -151,3 +152,3 @@ } | ||
min: Infinity, | ||
max: -Infinity | ||
max: -Infinity, | ||
}); | ||
@@ -163,5 +164,5 @@ } | ||
// determine if instrument allows negative values. | ||
const allowsNegativeValues = (descriptor.type === InstrumentDescriptor_1.InstrumentType.UP_DOWN_COUNTER) || | ||
(descriptor.type === InstrumentDescriptor_1.InstrumentType.OBSERVABLE_GAUGE) || | ||
(descriptor.type === InstrumentDescriptor_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER); | ||
const allowsNegativeValues = descriptor.type === InstrumentDescriptor_1.InstrumentType.UP_DOWN_COUNTER || | ||
descriptor.type === InstrumentDescriptor_1.InstrumentType.OBSERVABLE_GAUGE || | ||
descriptor.type === InstrumentDescriptor_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER; | ||
return { | ||
@@ -176,6 +177,6 @@ attributes, | ||
buckets: pointValue.buckets, | ||
count: pointValue.count | ||
count: pointValue.count, | ||
}, | ||
}; | ||
}) | ||
}), | ||
}; | ||
@@ -182,0 +183,0 @@ } |
@@ -55,3 +55,6 @@ "use strict"; | ||
// nanoseconds may lose precisions. | ||
const latestAccumulation = (0, core_1.hrTimeToMicroseconds)(delta.sampleTime) >= (0, core_1.hrTimeToMicroseconds)(previous.sampleTime) ? delta : previous; | ||
const latestAccumulation = (0, core_1.hrTimeToMicroseconds)(delta.sampleTime) >= | ||
(0, core_1.hrTimeToMicroseconds)(previous.sampleTime) | ||
? delta | ||
: previous; | ||
return new LastValueAccumulation(previous.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime); | ||
@@ -67,3 +70,6 @@ } | ||
// nanoseconds may lose precisions. | ||
const latestAccumulation = (0, core_1.hrTimeToMicroseconds)(current.sampleTime) >= (0, core_1.hrTimeToMicroseconds)(previous.sampleTime) ? current : previous; | ||
const latestAccumulation = (0, core_1.hrTimeToMicroseconds)(current.sampleTime) >= | ||
(0, core_1.hrTimeToMicroseconds)(previous.sampleTime) | ||
? current | ||
: previous; | ||
return new LastValueAccumulation(current.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime); | ||
@@ -83,3 +89,3 @@ } | ||
}; | ||
}) | ||
}), | ||
}; | ||
@@ -86,0 +92,0 @@ } |
@@ -73,3 +73,3 @@ "use strict"; | ||
*/ | ||
if (this.monotonic && (prevPv > currPv)) { | ||
if (this.monotonic && prevPv > currPv) { | ||
return new SumAccumulation(current.startTime, this.monotonic, currPv, true); | ||
@@ -92,3 +92,3 @@ } | ||
}), | ||
isMonotonic: this.monotonic | ||
isMonotonic: this.monotonic, | ||
}; | ||
@@ -95,0 +95,0 @@ } |
@@ -53,3 +53,3 @@ "use strict"; | ||
spanId: this.spanId, | ||
traceId: this.traceId | ||
traceId: this.traceId, | ||
}; | ||
@@ -56,0 +56,0 @@ this.attributes = {}; |
@@ -31,2 +31,3 @@ "use strict"; | ||
getRandomInt(min, max) { | ||
//[min, max) | ||
return Math.floor(Math.random() * (max - min) + min); | ||
@@ -33,0 +34,0 @@ } |
@@ -9,4 +9,4 @@ import { InstrumentType } from '../InstrumentDescriptor'; | ||
/** | ||
* Aggregation temporality selector based on metric instrument types. | ||
*/ | ||
* Aggregation temporality selector based on metric instrument types. | ||
*/ | ||
export declare type AggregationTemporalitySelector = (instrumentType: InstrumentType) => AggregationTemporality; | ||
@@ -13,0 +13,0 @@ export declare const DEFAULT_AGGREGATION_SELECTOR: AggregationSelector; |
@@ -6,4 +6,10 @@ import { ExportResult } from '@opentelemetry/core'; | ||
import { PushMetricExporter } from './MetricExporter'; | ||
import { AggregationTemporalitySelector } from './AggregationSelector'; | ||
interface ConsoleMetricExporterOptions { | ||
temporalitySelector?: AggregationTemporalitySelector; | ||
} | ||
export declare class ConsoleMetricExporter implements PushMetricExporter { | ||
protected _shutdown: boolean; | ||
protected _temporalitySelector: AggregationTemporalitySelector; | ||
constructor(options?: ConsoleMetricExporterOptions); | ||
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void; | ||
@@ -15,2 +21,3 @@ forceFlush(): Promise<void>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ConsoleMetricExporter.d.ts.map |
@@ -20,7 +20,10 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const AggregationTemporality_1 = require("./AggregationTemporality"); | ||
const AggregationSelector_1 = require("./AggregationSelector"); | ||
/* eslint-disable no-console */ | ||
class ConsoleMetricExporter { | ||
constructor() { | ||
constructor(options) { | ||
var _a; | ||
this._shutdown = false; | ||
this._temporalitySelector = | ||
(_a = options === null || options === void 0 ? void 0 : options.temporalitySelector) !== null && _a !== void 0 ? _a : AggregationSelector_1.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
} | ||
@@ -39,3 +42,3 @@ export(metrics, resultCallback) { | ||
selectAggregationTemporality(_instrumentType) { | ||
return AggregationTemporality_1.AggregationTemporality.CUMULATIVE; | ||
return this._temporalitySelector(_instrumentType); | ||
} | ||
@@ -52,3 +55,3 @@ shutdown() { | ||
dataPointType: metric.dataPointType, | ||
dataPoints: metric.dataPoints | ||
dataPoints: metric.dataPoints, | ||
}); | ||
@@ -55,0 +58,0 @@ } |
@@ -32,4 +32,6 @@ "use strict"; | ||
this._shutdown = false; | ||
this._aggregationSelector = (_a = options === null || options === void 0 ? void 0 : options.aggregationSelector) !== null && _a !== void 0 ? _a : AggregationSelector_1.DEFAULT_AGGREGATION_SELECTOR; | ||
this._aggregationTemporalitySelector = (_b = options === null || options === void 0 ? void 0 : options.aggregationTemporalitySelector) !== null && _b !== void 0 ? _b : AggregationSelector_1.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
this._aggregationSelector = | ||
(_a = options === null || options === void 0 ? void 0 : options.aggregationSelector) !== null && _a !== void 0 ? _a : AggregationSelector_1.DEFAULT_AGGREGATION_SELECTOR; | ||
this._aggregationTemporalitySelector = | ||
(_b = options === null || options === void 0 ? void 0 : options.aggregationTemporalitySelector) !== null && _b !== void 0 ? _b : AggregationSelector_1.DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; | ||
} | ||
@@ -36,0 +38,0 @@ /** |
@@ -32,8 +32,10 @@ "use strict"; | ||
aggregationSelector: (_a = options.exporter.selectAggregation) === null || _a === void 0 ? void 0 : _a.bind(options.exporter), | ||
aggregationTemporalitySelector: (_b = options.exporter.selectAggregationTemporality) === null || _b === void 0 ? void 0 : _b.bind(options.exporter) | ||
aggregationTemporalitySelector: (_b = options.exporter.selectAggregationTemporality) === null || _b === void 0 ? void 0 : _b.bind(options.exporter), | ||
}); | ||
if (options.exportIntervalMillis !== undefined && options.exportIntervalMillis <= 0) { | ||
if (options.exportIntervalMillis !== undefined && | ||
options.exportIntervalMillis <= 0) { | ||
throw Error('exportIntervalMillis must be greater than 0'); | ||
} | ||
if (options.exportTimeoutMillis !== undefined && options.exportTimeoutMillis <= 0) { | ||
if (options.exportTimeoutMillis !== undefined && | ||
options.exportTimeoutMillis <= 0) { | ||
throw Error('exportTimeoutMillis must be greater than 0'); | ||
@@ -40,0 +42,0 @@ } |
@@ -1,15 +0,15 @@ | ||
export { Sum, LastValue, Histogram, } from './aggregator/types'; | ||
export { Sum, LastValue, Histogram } from './aggregator/types'; | ||
export { AggregationSelector, AggregationTemporalitySelector, } from './export/AggregationSelector'; | ||
export { AggregationTemporality, } from './export/AggregationTemporality'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { PushMetricExporter, } from './export/MetricExporter'; | ||
export { PushMetricExporter } from './export/MetricExporter'; | ||
export { MetricReader, MetricReaderOptions } from './export/MetricReader'; | ||
export { PeriodicExportingMetricReader, PeriodicExportingMetricReaderOptions, } from './export/PeriodicExportingMetricReader'; | ||
export { InMemoryMetricExporter, } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter, } from './export/ConsoleMetricExporter'; | ||
export { InstrumentDescriptor, InstrumentType, } from './InstrumentDescriptor'; | ||
export { MeterProvider, MeterProviderOptions, } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation } from './view/Aggregation'; | ||
export { View, ViewOptions, } from './view/View'; | ||
export { InMemoryMetricExporter } from './export/InMemoryMetricExporter'; | ||
export { ConsoleMetricExporter } from './export/ConsoleMetricExporter'; | ||
export { InstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; | ||
export { MeterProvider, MeterProviderOptions } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View, ViewOptions } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -55,8 +55,8 @@ "use strict"; | ||
function isDescriptorCompatibleWith(descriptor, otherDescriptor) { | ||
return descriptor.name === otherDescriptor.name | ||
&& descriptor.unit === otherDescriptor.unit | ||
&& descriptor.type === otherDescriptor.type | ||
&& descriptor.valueType === otherDescriptor.valueType; | ||
return (descriptor.name === otherDescriptor.name && | ||
descriptor.unit === otherDescriptor.unit && | ||
descriptor.type === otherDescriptor.type && | ||
descriptor.valueType === otherDescriptor.valueType); | ||
} | ||
exports.isDescriptorCompatibleWith = isDescriptorCompatibleWith; | ||
//# sourceMappingURL=InstrumentDescriptor.js.map |
@@ -27,3 +27,4 @@ "use strict"; | ||
_record(value, attributes = {}, context = api_1.context.active()) { | ||
if (this._descriptor.valueType === api_1.ValueType.INT && !Number.isInteger(value)) { | ||
if (this._descriptor.valueType === api_1.ValueType.INT && | ||
!Number.isInteger(value)) { | ||
api_1.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`); | ||
@@ -30,0 +31,0 @@ value = Math.trunc(value); |
@@ -30,3 +30,4 @@ "use strict"; | ||
this._shutdown = false; | ||
this._sharedState = new MeterProviderSharedState_1.MeterProviderSharedState((_a = options === null || options === void 0 ? void 0 : options.resource) !== null && _a !== void 0 ? _a : resources_1.Resource.empty()); | ||
const resource = resources_1.Resource.default().merge((_a = options === null || options === void 0 ? void 0 : options.resource) !== null && _a !== void 0 ? _a : resources_1.Resource.empty()); | ||
this._sharedState = new MeterProviderSharedState_1.MeterProviderSharedState(resource); | ||
if ((options === null || options === void 0 ? void 0 : options.views) != null && options.views.length > 0) { | ||
@@ -47,5 +48,7 @@ for (const view of options.views) { | ||
} | ||
return this._sharedState | ||
.getMeterSharedState({ name, version, schemaUrl: options.schemaUrl }) | ||
.meter; | ||
return this._sharedState.getMeterSharedState({ | ||
name, | ||
version, | ||
schemaUrl: options.schemaUrl, | ||
}).meter; | ||
} | ||
@@ -52,0 +55,0 @@ /** |
@@ -37,3 +37,4 @@ "use strict"; | ||
observe(value, attributes = {}) { | ||
if (this._descriptor.valueType === api_1.ValueType.INT && !Number.isInteger(value)) { | ||
if (this._descriptor.valueType === api_1.ValueType.INT && | ||
!Number.isInteger(value)) { | ||
api_1.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`); | ||
@@ -68,3 +69,4 @@ value = Math.trunc(value); | ||
} | ||
if (metric._descriptor.valueType === api_1.ValueType.INT && !Number.isInteger(value)) { | ||
if (metric._descriptor.valueType === api_1.ValueType.INT && | ||
!Number.isInteger(value)) { | ||
api_1.diag.warn(`INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.`); | ||
@@ -71,0 +73,0 @@ value = Math.trunc(value); |
@@ -77,4 +77,3 @@ "use strict"; | ||
const views = this._meterProviderSharedState.viewRegistry.findViews(descriptor, this._instrumentationScope); | ||
let storages = views | ||
.map(view => { | ||
let storages = views.map(view => { | ||
const viewDescriptor = (0, InstrumentDescriptor_1.createInstrumentDescriptorWithView)(view, descriptor); | ||
@@ -81,0 +80,0 @@ const compatibleStorage = this.metricStorageRegistry.findOrUpdateCompatibleStorage(viewDescriptor); |
@@ -33,4 +33,3 @@ "use strict"; | ||
const collectionTime = (0, core_1.hrTime)(); | ||
const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()) | ||
.map(meterSharedState => meterSharedState.collect(this, collectionTime, options)); | ||
const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()).map(meterSharedState => meterSharedState.collect(this, collectionTime, options)); | ||
const result = await Promise.all(meterCollectionPromises); | ||
@@ -37,0 +36,0 @@ return { |
@@ -36,3 +36,3 @@ "use strict"; | ||
valueType: this._instrumentDescriptor.valueType, | ||
unit: this._instrumentDescriptor.unit | ||
unit: this._instrumentDescriptor.unit, | ||
}); | ||
@@ -39,0 +39,0 @@ } |
@@ -71,3 +71,3 @@ "use strict"; | ||
} | ||
const storages = this._sharedRegistry.get(expectedDescriptor.name); | ||
const storages = storageMap.get(expectedDescriptor.name); | ||
if (storages === undefined) { | ||
@@ -96,3 +96,4 @@ return null; | ||
if (existingDescriptor.description !== expectedDescriptor.description) { | ||
if (expectedDescriptor.description.length > existingDescriptor.description.length) { | ||
if (expectedDescriptor.description.length > | ||
existingDescriptor.description.length) { | ||
existingStorage.updateDescription(expectedDescriptor.description); | ||
@@ -99,0 +100,0 @@ } |
@@ -76,4 +76,8 @@ "use strict"; | ||
const batchCallbackFutures = this._observeBatchCallbacks(collectionTime, timeoutMillis); | ||
const results = await (0, utils_1.PromiseAllSettled)([...callbackFutures, ...batchCallbackFutures]); | ||
const rejections = results.filter(utils_1.isPromiseAllSettledRejectionResult) | ||
const results = await (0, utils_1.PromiseAllSettled)([ | ||
...callbackFutures, | ||
...batchCallbackFutures, | ||
]); | ||
const rejections = results | ||
.filter(utils_1.isPromiseAllSettledRejectionResult) | ||
.map(it => it.reason); | ||
@@ -83,4 +87,3 @@ return rejections; | ||
_observeCallbacks(observationTime, timeoutMillis) { | ||
return this._callbacks | ||
.map(async ({ callback, instrument }) => { | ||
return this._callbacks.map(async ({ callback, instrument }) => { | ||
const observableResult = new ObservableResult_1.ObservableResultImpl(instrument._descriptor); | ||
@@ -98,4 +101,3 @@ let callPromise = Promise.resolve(callback(observableResult)); | ||
_observeBatchCallbacks(observationTime, timeoutMillis) { | ||
return this._batchCallbacks | ||
.map(async ({ callback, instruments }) => { | ||
return this._batchCallbacks.map(async ({ callback, instruments }) => { | ||
const observableResult = new ObservableResult_1.BatchObservableResultImpl(); | ||
@@ -125,3 +127,4 @@ let callPromise = Promise.resolve(callback(observableResult)); | ||
return this._batchCallbacks.findIndex(record => { | ||
return record.callback === callback && (0, utils_1.setEquals)(record.instruments, instruments); | ||
return (record.callback === callback && | ||
(0, utils_1.setEquals)(record.instruments, instruments)); | ||
}); | ||
@@ -128,0 +131,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.8.0"; | ||
export declare const VERSION = "1.9.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '1.8.0'; | ||
exports.VERSION = '1.9.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -49,3 +49,3 @@ "use strict"; | ||
.filter(attributeName => this._allowedAttributeNames.includes(attributeName)) | ||
.forEach(attributeName => filteredAttributes[attributeName] = incoming[attributeName]); | ||
.forEach(attributeName => (filteredAttributes[attributeName] = incoming[attributeName])); | ||
return filteredAttributes; | ||
@@ -55,3 +55,3 @@ } | ||
exports.FilteringAttributesProcessor = FilteringAttributesProcessor; | ||
const NOOP = new NoopAttributesProcessor; | ||
const NOOP = new NoopAttributesProcessor(); | ||
//# sourceMappingURL=AttributesProcessor.js.map |
@@ -47,3 +47,3 @@ "use strict"; | ||
name: otherDescriptor.name, | ||
type: otherDescriptor.type | ||
type: otherDescriptor.type, | ||
}; | ||
@@ -57,3 +57,3 @@ const selectorString = JSON.stringify(selector); | ||
name: otherDescriptor.name, | ||
type: otherDescriptor.type | ||
type: otherDescriptor.type, | ||
}; | ||
@@ -60,0 +60,0 @@ const selectorString = JSON.stringify(selector); |
@@ -115,3 +115,3 @@ "use strict"; | ||
version: viewOptions.meterVersion, | ||
schemaUrl: viewOptions.meterSchemaUrl | ||
schemaUrl: viewOptions.meterSchemaUrl, | ||
}); | ||
@@ -118,0 +118,0 @@ } |
@@ -27,6 +27,5 @@ "use strict"; | ||
findViews(instrument, meter) { | ||
const views = this._registeredViews | ||
.filter(registeredView => { | ||
return this._matchInstrument(registeredView.instrumentSelector, instrument) && | ||
this._matchMeter(registeredView.meterSelector, meter); | ||
const views = this._registeredViews.filter(registeredView => { | ||
return (this._matchInstrument(registeredView.instrumentSelector, instrument) && | ||
this._matchMeter(registeredView.meterSelector, meter)); | ||
}); | ||
@@ -36,9 +35,12 @@ return views; | ||
_matchInstrument(selector, instrument) { | ||
return (selector.getType() === undefined || instrument.type === selector.getType()) && | ||
selector.getNameFilter().match(instrument.name); | ||
return ((selector.getType() === undefined || | ||
instrument.type === selector.getType()) && | ||
selector.getNameFilter().match(instrument.name)); | ||
} | ||
_matchMeter(selector, meter) { | ||
return selector.getNameFilter().match(meter.name) && | ||
(meter.version === undefined || selector.getVersionFilter().match(meter.version)) && | ||
(meter.schemaUrl === undefined || selector.getSchemaUrlFilter().match(meter.schemaUrl)); | ||
return (selector.getNameFilter().match(meter.name) && | ||
(meter.version === undefined || | ||
selector.getVersionFilter().match(meter.version)) && | ||
(meter.schemaUrl === undefined || | ||
selector.getSchemaUrlFilter().match(meter.schemaUrl))); | ||
} | ||
@@ -45,0 +47,0 @@ } |
{ | ||
"name": "@opentelemetry/sdk-metrics", | ||
"version": "1.8.0", | ||
"description": "Work in progress OpenTelemetry metrics SDK", | ||
"version": "1.9.0", | ||
"description": "OpenTelemetry metrics SDK", | ||
"main": "build/src/index.js", | ||
@@ -12,4 +12,4 @@ "module": "build/esm/index.js", | ||
"prepublishOnly": "npm run compile", | ||
"compile": "tsc --build tsconfig.all.json", | ||
"clean": "tsc --build --clean tsconfig.all.json", | ||
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", | ||
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", | ||
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", | ||
@@ -23,3 +23,3 @@ "test:browser": "nyc karma start --single-run", | ||
"version": "node ../../scripts/version-update.js", | ||
"watch": "tsc --build --watch tsconfig.all.json", | ||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", | ||
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", | ||
@@ -59,3 +59,3 @@ "prewatch": "node ../../scripts/version-update.js", | ||
"devDependencies": { | ||
"@opentelemetry/api": ">=1.3.0 <1.4.0", | ||
"@opentelemetry/api": ">=1.3.0 <1.5.0", | ||
"@types/lodash.merge": "4.6.6", | ||
@@ -75,3 +75,3 @@ "@types/mocha": "10.0.0", | ||
"rimraf": "3.0.2", | ||
"sinon": "14.0.0", | ||
"sinon": "15.0.0", | ||
"ts-mocha": "10.0.0", | ||
@@ -81,12 +81,12 @@ "typescript": "4.4.4" | ||
"peerDependencies": { | ||
"@opentelemetry/api": ">=1.3.0 <1.4.0" | ||
"@opentelemetry/api": ">=1.3.0 <1.5.0" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/core": "1.8.0", | ||
"@opentelemetry/resources": "1.8.0", | ||
"@opentelemetry/core": "1.9.0", | ||
"@opentelemetry/resources": "1.9.0", | ||
"lodash.merge": "4.6.2" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-metrics", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics", | ||
"sideEffects": false, | ||
"gitHead": "7972edf6659fb6e0d5928a5cf7a35f26683e168f" | ||
"gitHead": "08f597f3a3d71a4852b0afbba120af15ca038121" | ||
} |
@@ -6,6 +6,4 @@ # OpenTelemetry Metrics SDK | ||
**Note: This is an experimental package under active development. New releases may include breaking changes.** | ||
This module contains the Metrics SDK of [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js). | ||
OpenTelemetry metrics module contains the foundation for all metrics SDKs of [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js). | ||
Used standalone, this module provides methods for manual instrumentation of code, offering full control over recording metrics for client-side JavaScript (browser) and Node.js. | ||
@@ -95,2 +93,2 @@ | ||
[npm-url]: https://www.npmjs.com/package/@opentelemetry/sdk-metrics | ||
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fmetrics.svg | ||
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fsdk%2Dmetrics.svg |
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
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
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
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
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
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
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
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1432686
15947
0
93
+ Added@opentelemetry/api@1.4.1(transitive)
+ Added@opentelemetry/core@1.9.0(transitive)
+ Added@opentelemetry/resources@1.9.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.9.0(transitive)
- Removed@opentelemetry/api@1.3.0(transitive)
- Removed@opentelemetry/core@1.8.0(transitive)
- Removed@opentelemetry/resources@1.8.0(transitive)
- Removed@opentelemetry/semantic-conventions@1.8.0(transitive)
Updated@opentelemetry/core@1.9.0