@opentelemetry/sdk-metrics
Advanced tools
Comparing version 1.10.1 to 1.11.0
@@ -26,3 +26,3 @@ import { Mapping } from './types'; | ||
*/ | ||
scale(): number; | ||
get scale(): number; | ||
private _minNormalLowerBoundaryIndex; | ||
@@ -29,0 +29,0 @@ private _maxNormalLowerBoundaryIndex; |
@@ -61,12 +61,16 @@ /* | ||
}; | ||
/** | ||
* The scale used by this mapping | ||
* @returns {number} | ||
*/ | ||
ExponentMapping.prototype.scale = function () { | ||
if (this._shift === 0) { | ||
return 0; | ||
} | ||
return -this._shift; | ||
}; | ||
Object.defineProperty(ExponentMapping.prototype, "scale", { | ||
/** | ||
* The scale used by this mapping | ||
* @returns {number} | ||
*/ | ||
get: function () { | ||
if (this._shift === 0) { | ||
return 0; | ||
} | ||
return -this._shift; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
ExponentMapping.prototype._minNormalLowerBoundaryIndex = function () { | ||
@@ -73,0 +77,0 @@ var index = ieee754.MIN_NORMAL_EXPONENT >> this._shift; |
@@ -28,3 +28,3 @@ import { Mapping } from './types'; | ||
*/ | ||
scale(): number; | ||
get scale(): number; | ||
private _minNormalLowerBoundaryIndex; | ||
@@ -31,0 +31,0 @@ private _maxNormalLowerBoundaryIndex; |
@@ -77,9 +77,13 @@ /* | ||
}; | ||
/** | ||
* The scale used by this mapping | ||
* @returns {number} | ||
*/ | ||
LogarithmMapping.prototype.scale = function () { | ||
return this._scale; | ||
}; | ||
Object.defineProperty(LogarithmMapping.prototype, "scale", { | ||
/** | ||
* The scale used by this mapping | ||
* @returns {number} | ||
*/ | ||
get: function () { | ||
return this._scale; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
LogarithmMapping.prototype._minNormalLowerBoundaryIndex = function () { | ||
@@ -86,0 +90,0 @@ return ieee754.MIN_NORMAL_EXPONENT << this._scale; |
@@ -11,4 +11,4 @@ export declare class MappingError extends Error { | ||
lowerBoundary(index: number): number; | ||
scale(): number; | ||
get scale(): number; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -15,2 +15,10 @@ /** | ||
export declare function ldexp(frac: number, exp: number): number; | ||
/** | ||
* Computes the next power of two that is greater than or equal to v. | ||
* This implementation more efficient than, but functionally equivalent | ||
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))). | ||
* @param v | ||
* @returns {number} | ||
*/ | ||
export declare function nextGreaterSquare(v: number): number; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -38,2 +38,22 @@ /* | ||
} | ||
/** | ||
* Computes the next power of two that is greater than or equal to v. | ||
* This implementation more efficient than, but functionally equivalent | ||
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))). | ||
* @param v | ||
* @returns {number} | ||
*/ | ||
export function nextGreaterSquare(v) { | ||
// The following expression computes the least power-of-two | ||
// that is >= v. There are a number of tricky ways to | ||
// do this, see https://stackoverflow.com/questions/466204/rounding-up-to-next-power-of-2 | ||
v--; | ||
v |= v >> 1; | ||
v |= v >> 2; | ||
v |= v >> 4; | ||
v |= v >> 8; | ||
v |= v >> 16; | ||
v++; | ||
return v; | ||
} | ||
//# sourceMappingURL=util.js.map |
export * from './Drop'; | ||
export * from './Histogram'; | ||
export * from './ExponentialHistogram'; | ||
export * from './LastValue'; | ||
@@ -4,0 +5,0 @@ export * from './Sum'; |
@@ -18,4 +18,5 @@ /* | ||
export * from './Histogram'; | ||
export * from './ExponentialHistogram'; | ||
export * from './LastValue'; | ||
export * from './Sum'; | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,4 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; | ||
LAST_VALUE = 2, | ||
HISTOGRAM = 3 | ||
HISTOGRAM = 3, | ||
EXPONENTIAL_HISTOGRAM = 4 | ||
} | ||
@@ -45,2 +46,19 @@ /** DataPoint value type for SumAggregation. */ | ||
} | ||
/** DataPoint value type for ExponentialHistogramAggregation. */ | ||
export interface ExponentialHistogram { | ||
count: number; | ||
sum?: number; | ||
scale: number; | ||
zeroCount: number; | ||
positive: { | ||
offset: number; | ||
bucketCounts: number[]; | ||
}; | ||
negative: { | ||
offset: number; | ||
bucketCounts: number[]; | ||
}; | ||
min?: number; | ||
max?: number; | ||
} | ||
/** | ||
@@ -47,0 +65,0 @@ * An Aggregator accumulation state. |
@@ -23,3 +23,4 @@ /* | ||
AggregatorKind[AggregatorKind["HISTOGRAM"] = 3] = "HISTOGRAM"; | ||
AggregatorKind[AggregatorKind["EXPONENTIAL_HISTOGRAM"] = 4] = "EXPONENTIAL_HISTOGRAM"; | ||
})(AggregatorKind || (AggregatorKind = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -6,3 +6,3 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; | ||
import { AggregationTemporality } from './AggregationTemporality'; | ||
import { Histogram } from '../aggregator/types'; | ||
import { Histogram, ExponentialHistogram } from '../aggregator/types'; | ||
/** | ||
@@ -40,5 +40,12 @@ * Basic metric data fields. | ||
/** | ||
* Represents a metric data aggregated by a ExponentialHistogramAggregation. | ||
*/ | ||
export interface ExponentialHistogramMetricData extends BaseMetricData { | ||
readonly dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM; | ||
readonly dataPoints: DataPoint<ExponentialHistogram>[]; | ||
} | ||
/** | ||
* Represents an aggregated metric data. | ||
*/ | ||
export declare type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData; | ||
export declare type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData | ExponentialHistogramMetricData; | ||
export interface ScopeMetrics { | ||
@@ -45,0 +52,0 @@ scope: InstrumentationScope; |
@@ -1,5 +0,5 @@ | ||
export { Sum, LastValue, Histogram } from './aggregator/types'; | ||
export { Sum, LastValue, Histogram, ExponentialHistogram, } from './aggregator/types'; | ||
export { AggregationSelector, AggregationTemporalitySelector, } from './export/AggregationSelector'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ExponentialHistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { PushMetricExporter } from './export/MetricExporter'; | ||
@@ -12,5 +12,5 @@ export { MetricReader, MetricReaderOptions } from './export/MetricReader'; | ||
export { MeterProvider, MeterProviderOptions } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, ExponentialHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View, ViewOptions } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -24,5 +24,5 @@ /* | ||
export { MeterProvider } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, ExponentialHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -60,2 +60,3 @@ /* | ||
var delta = accumulation; | ||
// Diff with recorded cumulative memo. | ||
if (_this._cumulativeMemoStorage.has(attributes, hashCode)) { | ||
@@ -67,2 +68,9 @@ // has() returned true, previous is present. | ||
} | ||
// Merge with uncollected active delta. | ||
if (_this._activeCollectionStorage.has(attributes, hashCode)) { | ||
// has() returned true, previous is present. | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
var active = _this._activeCollectionStorage.get(attributes, hashCode); | ||
delta = _this._aggregator.merge(active, delta); | ||
} | ||
// Save the current record and the delta record. | ||
@@ -69,0 +77,0 @@ _this._cumulativeMemoStorage.set(attributes, accumulation, hashCode); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.10.1"; | ||
export declare const VERSION = "1.11.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '1.10.1'; | ||
export var VERSION = '1.11.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
import { Aggregator, SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator } from '../aggregator'; | ||
import { Aggregator, SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, ExponentialHistogramAggregator } from '../aggregator'; | ||
import { Accumulation } from '../aggregator/types'; | ||
@@ -16,2 +16,3 @@ import { InstrumentDescriptor } from '../InstrumentDescriptor'; | ||
static Histogram(): Aggregation; | ||
static ExponentialHistogram(): Aggregation; | ||
static Default(): Aggregation; | ||
@@ -61,2 +62,8 @@ } | ||
} | ||
export declare class ExponentialHistogramAggregation extends Aggregation { | ||
private readonly _maxSize; | ||
private readonly _recordMinMax; | ||
constructor(_maxSize?: number, _recordMinMax?: boolean); | ||
createAggregator(_instrument: InstrumentDescriptor): ExponentialHistogramAggregator; | ||
} | ||
/** | ||
@@ -63,0 +70,0 @@ * The default aggregation. |
@@ -32,3 +32,3 @@ /* | ||
import * as api from '@opentelemetry/api'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, } from '../aggregator'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, ExponentialHistogramAggregator, } from '../aggregator'; | ||
import { InstrumentType } from '../InstrumentDescriptor'; | ||
@@ -55,2 +55,5 @@ /** | ||
}; | ||
Aggregation.ExponentialHistogram = function () { | ||
return EXPONENTIAL_HISTOGRAM_AGGREGATION; | ||
}; | ||
Aggregation.Default = function () { | ||
@@ -168,2 +171,18 @@ return DEFAULT_AGGREGATION; | ||
export { ExplicitBucketHistogramAggregation }; | ||
var ExponentialHistogramAggregation = /** @class */ (function (_super) { | ||
__extends(ExponentialHistogramAggregation, _super); | ||
function ExponentialHistogramAggregation(_maxSize, _recordMinMax) { | ||
if (_maxSize === void 0) { _maxSize = 160; } | ||
if (_recordMinMax === void 0) { _recordMinMax = true; } | ||
var _this = _super.call(this) || this; | ||
_this._maxSize = _maxSize; | ||
_this._recordMinMax = _recordMinMax; | ||
return _this; | ||
} | ||
ExponentialHistogramAggregation.prototype.createAggregator = function (_instrument) { | ||
return new ExponentialHistogramAggregator(this._maxSize, this._recordMinMax); | ||
}; | ||
return ExponentialHistogramAggregation; | ||
}(Aggregation)); | ||
export { ExponentialHistogramAggregation }; | ||
/** | ||
@@ -206,3 +225,4 @@ * The default aggregation. | ||
var HISTOGRAM_AGGREGATION = new HistogramAggregation(); | ||
var EXPONENTIAL_HISTOGRAM_AGGREGATION = new ExponentialHistogramAggregation(); | ||
var DEFAULT_AGGREGATION = new DefaultAggregation(); | ||
//# sourceMappingURL=Aggregation.js.map |
@@ -26,3 +26,3 @@ import { Mapping } from './types'; | ||
*/ | ||
scale(): number; | ||
get scale(): number; | ||
private _minNormalLowerBoundaryIndex; | ||
@@ -29,0 +29,0 @@ private _maxNormalLowerBoundaryIndex; |
@@ -65,3 +65,3 @@ /* | ||
*/ | ||
scale() { | ||
get scale() { | ||
if (this._shift === 0) { | ||
@@ -68,0 +68,0 @@ return 0; |
@@ -28,3 +28,3 @@ import { Mapping } from './types'; | ||
*/ | ||
scale(): number; | ||
get scale(): number; | ||
private _minNormalLowerBoundaryIndex; | ||
@@ -31,0 +31,0 @@ private _maxNormalLowerBoundaryIndex; |
@@ -81,3 +81,3 @@ /* | ||
*/ | ||
scale() { | ||
get scale() { | ||
return this._scale; | ||
@@ -84,0 +84,0 @@ } |
@@ -11,4 +11,4 @@ export declare class MappingError extends Error { | ||
lowerBoundary(index: number): number; | ||
scale(): number; | ||
get scale(): number; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -15,2 +15,10 @@ /** | ||
export declare function ldexp(frac: number, exp: number): number; | ||
/** | ||
* Computes the next power of two that is greater than or equal to v. | ||
* This implementation more efficient than, but functionally equivalent | ||
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))). | ||
* @param v | ||
* @returns {number} | ||
*/ | ||
export declare function nextGreaterSquare(v: number): number; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -38,2 +38,22 @@ /* | ||
} | ||
/** | ||
* Computes the next power of two that is greater than or equal to v. | ||
* This implementation more efficient than, but functionally equivalent | ||
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))). | ||
* @param v | ||
* @returns {number} | ||
*/ | ||
export function nextGreaterSquare(v) { | ||
// The following expression computes the least power-of-two | ||
// that is >= v. There are a number of tricky ways to | ||
// do this, see https://stackoverflow.com/questions/466204/rounding-up-to-next-power-of-2 | ||
v--; | ||
v |= v >> 1; | ||
v |= v >> 2; | ||
v |= v >> 4; | ||
v |= v >> 8; | ||
v |= v >> 16; | ||
v++; | ||
return v; | ||
} | ||
//# sourceMappingURL=util.js.map |
export * from './Drop'; | ||
export * from './Histogram'; | ||
export * from './ExponentialHistogram'; | ||
export * from './LastValue'; | ||
@@ -4,0 +5,0 @@ export * from './Sum'; |
@@ -18,4 +18,5 @@ /* | ||
export * from './Histogram'; | ||
export * from './ExponentialHistogram'; | ||
export * from './LastValue'; | ||
export * from './Sum'; | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,4 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; | ||
LAST_VALUE = 2, | ||
HISTOGRAM = 3 | ||
HISTOGRAM = 3, | ||
EXPONENTIAL_HISTOGRAM = 4 | ||
} | ||
@@ -45,2 +46,19 @@ /** DataPoint value type for SumAggregation. */ | ||
} | ||
/** DataPoint value type for ExponentialHistogramAggregation. */ | ||
export interface ExponentialHistogram { | ||
count: number; | ||
sum?: number; | ||
scale: number; | ||
zeroCount: number; | ||
positive: { | ||
offset: number; | ||
bucketCounts: number[]; | ||
}; | ||
negative: { | ||
offset: number; | ||
bucketCounts: number[]; | ||
}; | ||
min?: number; | ||
max?: number; | ||
} | ||
/** | ||
@@ -47,0 +65,0 @@ * An Aggregator accumulation state. |
@@ -23,3 +23,4 @@ /* | ||
AggregatorKind[AggregatorKind["HISTOGRAM"] = 3] = "HISTOGRAM"; | ||
AggregatorKind[AggregatorKind["EXPONENTIAL_HISTOGRAM"] = 4] = "EXPONENTIAL_HISTOGRAM"; | ||
})(AggregatorKind || (AggregatorKind = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -6,3 +6,3 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; | ||
import { AggregationTemporality } from './AggregationTemporality'; | ||
import { Histogram } from '../aggregator/types'; | ||
import { Histogram, ExponentialHistogram } from '../aggregator/types'; | ||
/** | ||
@@ -40,5 +40,12 @@ * Basic metric data fields. | ||
/** | ||
* Represents a metric data aggregated by a ExponentialHistogramAggregation. | ||
*/ | ||
export interface ExponentialHistogramMetricData extends BaseMetricData { | ||
readonly dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM; | ||
readonly dataPoints: DataPoint<ExponentialHistogram>[]; | ||
} | ||
/** | ||
* Represents an aggregated metric data. | ||
*/ | ||
export declare type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData; | ||
export declare type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData | ExponentialHistogramMetricData; | ||
export interface ScopeMetrics { | ||
@@ -45,0 +52,0 @@ scope: InstrumentationScope; |
@@ -1,5 +0,5 @@ | ||
export { Sum, LastValue, Histogram } from './aggregator/types'; | ||
export { Sum, LastValue, Histogram, ExponentialHistogram, } from './aggregator/types'; | ||
export { AggregationSelector, AggregationTemporalitySelector, } from './export/AggregationSelector'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ExponentialHistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { PushMetricExporter } from './export/MetricExporter'; | ||
@@ -12,5 +12,5 @@ export { MetricReader, MetricReaderOptions } from './export/MetricReader'; | ||
export { MeterProvider, MeterProviderOptions } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, ExponentialHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View, ViewOptions } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -24,5 +24,5 @@ /* | ||
export { MeterProvider } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, ExponentialHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -41,2 +41,3 @@ /* | ||
let delta = accumulation; | ||
// Diff with recorded cumulative memo. | ||
if (this._cumulativeMemoStorage.has(attributes, hashCode)) { | ||
@@ -48,2 +49,9 @@ // has() returned true, previous is present. | ||
} | ||
// Merge with uncollected active delta. | ||
if (this._activeCollectionStorage.has(attributes, hashCode)) { | ||
// has() returned true, previous is present. | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const active = this._activeCollectionStorage.get(attributes, hashCode); | ||
delta = this._aggregator.merge(active, delta); | ||
} | ||
// Save the current record and the delta record. | ||
@@ -50,0 +58,0 @@ this._cumulativeMemoStorage.set(attributes, accumulation, hashCode); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.10.1"; | ||
export declare const VERSION = "1.11.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '1.10.1'; | ||
export const VERSION = '1.11.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
import { Aggregator, SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator } from '../aggregator'; | ||
import { Aggregator, SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, ExponentialHistogramAggregator } from '../aggregator'; | ||
import { Accumulation } from '../aggregator/types'; | ||
@@ -16,2 +16,3 @@ import { InstrumentDescriptor } from '../InstrumentDescriptor'; | ||
static Histogram(): Aggregation; | ||
static ExponentialHistogram(): Aggregation; | ||
static Default(): Aggregation; | ||
@@ -61,2 +62,8 @@ } | ||
} | ||
export declare class ExponentialHistogramAggregation extends Aggregation { | ||
private readonly _maxSize; | ||
private readonly _recordMinMax; | ||
constructor(_maxSize?: number, _recordMinMax?: boolean); | ||
createAggregator(_instrument: InstrumentDescriptor): ExponentialHistogramAggregator; | ||
} | ||
/** | ||
@@ -63,0 +70,0 @@ * The default aggregation. |
@@ -17,3 +17,3 @@ /* | ||
import * as api from '@opentelemetry/api'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, } from '../aggregator'; | ||
import { SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, ExponentialHistogramAggregator, } from '../aggregator'; | ||
import { InstrumentType } from '../InstrumentDescriptor'; | ||
@@ -38,2 +38,5 @@ /** | ||
} | ||
static ExponentialHistogram() { | ||
return EXPONENTIAL_HISTOGRAM_AGGREGATION; | ||
} | ||
static Default() { | ||
@@ -120,2 +123,12 @@ return DEFAULT_AGGREGATION; | ||
} | ||
export class ExponentialHistogramAggregation extends Aggregation { | ||
constructor(_maxSize = 160, _recordMinMax = true) { | ||
super(); | ||
this._maxSize = _maxSize; | ||
this._recordMinMax = _recordMinMax; | ||
} | ||
createAggregator(_instrument) { | ||
return new ExponentialHistogramAggregator(this._maxSize, this._recordMinMax); | ||
} | ||
} | ||
/** | ||
@@ -152,3 +165,4 @@ * The default aggregation. | ||
const HISTOGRAM_AGGREGATION = new HistogramAggregation(); | ||
const EXPONENTIAL_HISTOGRAM_AGGREGATION = new ExponentialHistogramAggregation(); | ||
const DEFAULT_AGGREGATION = new DefaultAggregation(); | ||
//# sourceMappingURL=Aggregation.js.map |
@@ -26,3 +26,3 @@ import { Mapping } from './types'; | ||
*/ | ||
scale(): number; | ||
get scale(): number; | ||
private _minNormalLowerBoundaryIndex; | ||
@@ -29,0 +29,0 @@ private _maxNormalLowerBoundaryIndex; |
@@ -68,3 +68,3 @@ "use strict"; | ||
*/ | ||
scale() { | ||
get scale() { | ||
if (this._shift === 0) { | ||
@@ -71,0 +71,0 @@ return 0; |
@@ -28,3 +28,3 @@ import { Mapping } from './types'; | ||
*/ | ||
scale(): number; | ||
get scale(): number; | ||
private _minNormalLowerBoundaryIndex; | ||
@@ -31,0 +31,0 @@ private _maxNormalLowerBoundaryIndex; |
@@ -84,3 +84,3 @@ "use strict"; | ||
*/ | ||
scale() { | ||
get scale() { | ||
return this._scale; | ||
@@ -87,0 +87,0 @@ } |
@@ -11,4 +11,4 @@ export declare class MappingError extends Error { | ||
lowerBoundary(index: number): number; | ||
scale(): number; | ||
get scale(): number; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -15,2 +15,10 @@ /** | ||
export declare function ldexp(frac: number, exp: number): number; | ||
/** | ||
* Computes the next power of two that is greater than or equal to v. | ||
* This implementation more efficient than, but functionally equivalent | ||
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))). | ||
* @param v | ||
* @returns {number} | ||
*/ | ||
export declare function nextGreaterSquare(v: number): number; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ldexp = void 0; | ||
exports.nextGreaterSquare = exports.ldexp = void 0; | ||
/** | ||
@@ -43,2 +43,23 @@ * Note: other languages provide this as a built in function. This is | ||
exports.ldexp = ldexp; | ||
/** | ||
* Computes the next power of two that is greater than or equal to v. | ||
* This implementation more efficient than, but functionally equivalent | ||
* to Math.pow(2, Math.ceil(Math.log(x)/Math.log(2))). | ||
* @param v | ||
* @returns {number} | ||
*/ | ||
function nextGreaterSquare(v) { | ||
// The following expression computes the least power-of-two | ||
// that is >= v. There are a number of tricky ways to | ||
// do this, see https://stackoverflow.com/questions/466204/rounding-up-to-next-power-of-2 | ||
v--; | ||
v |= v >> 1; | ||
v |= v >> 2; | ||
v |= v >> 4; | ||
v |= v >> 8; | ||
v |= v >> 16; | ||
v++; | ||
return v; | ||
} | ||
exports.nextGreaterSquare = nextGreaterSquare; | ||
//# sourceMappingURL=util.js.map |
export * from './Drop'; | ||
export * from './Histogram'; | ||
export * from './ExponentialHistogram'; | ||
export * from './LastValue'; | ||
@@ -4,0 +5,0 @@ export * from './Sum'; |
@@ -30,4 +30,5 @@ "use strict"; | ||
__exportStar(require("./Histogram"), exports); | ||
__exportStar(require("./ExponentialHistogram"), exports); | ||
__exportStar(require("./LastValue"), exports); | ||
__exportStar(require("./Sum"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,4 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; | ||
LAST_VALUE = 2, | ||
HISTOGRAM = 3 | ||
HISTOGRAM = 3, | ||
EXPONENTIAL_HISTOGRAM = 4 | ||
} | ||
@@ -45,2 +46,19 @@ /** DataPoint value type for SumAggregation. */ | ||
} | ||
/** DataPoint value type for ExponentialHistogramAggregation. */ | ||
export interface ExponentialHistogram { | ||
count: number; | ||
sum?: number; | ||
scale: number; | ||
zeroCount: number; | ||
positive: { | ||
offset: number; | ||
bucketCounts: number[]; | ||
}; | ||
negative: { | ||
offset: number; | ||
bucketCounts: number[]; | ||
}; | ||
min?: number; | ||
max?: number; | ||
} | ||
/** | ||
@@ -47,0 +65,0 @@ * An Aggregator accumulation state. |
@@ -26,3 +26,4 @@ "use strict"; | ||
AggregatorKind[AggregatorKind["HISTOGRAM"] = 3] = "HISTOGRAM"; | ||
AggregatorKind[AggregatorKind["EXPONENTIAL_HISTOGRAM"] = 4] = "EXPONENTIAL_HISTOGRAM"; | ||
})(AggregatorKind = exports.AggregatorKind || (exports.AggregatorKind = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -6,3 +6,3 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; | ||
import { AggregationTemporality } from './AggregationTemporality'; | ||
import { Histogram } from '../aggregator/types'; | ||
import { Histogram, ExponentialHistogram } from '../aggregator/types'; | ||
/** | ||
@@ -40,5 +40,12 @@ * Basic metric data fields. | ||
/** | ||
* Represents a metric data aggregated by a ExponentialHistogramAggregation. | ||
*/ | ||
export interface ExponentialHistogramMetricData extends BaseMetricData { | ||
readonly dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM; | ||
readonly dataPoints: DataPoint<ExponentialHistogram>[]; | ||
} | ||
/** | ||
* Represents an aggregated metric data. | ||
*/ | ||
export declare type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData; | ||
export declare type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData | ExponentialHistogramMetricData; | ||
export interface ScopeMetrics { | ||
@@ -45,0 +52,0 @@ scope: InstrumentationScope; |
@@ -1,5 +0,5 @@ | ||
export { Sum, LastValue, Histogram } from './aggregator/types'; | ||
export { Sum, LastValue, Histogram, ExponentialHistogram, } from './aggregator/types'; | ||
export { AggregationSelector, AggregationTemporalitySelector, } from './export/AggregationSelector'; | ||
export { AggregationTemporality } from './export/AggregationTemporality'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { DataPoint, DataPointType, SumMetricData, GaugeMetricData, HistogramMetricData, ExponentialHistogramMetricData, ResourceMetrics, ScopeMetrics, MetricData, CollectionResult, } from './export/MetricData'; | ||
export { PushMetricExporter } from './export/MetricExporter'; | ||
@@ -12,5 +12,5 @@ export { MetricReader, MetricReaderOptions } from './export/MetricReader'; | ||
export { MeterProvider, MeterProviderOptions } from './MeterProvider'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { DefaultAggregation, ExplicitBucketHistogramAggregation, ExponentialHistogramAggregation, DropAggregation, HistogramAggregation, LastValueAggregation, SumAggregation, Aggregation, } from './view/Aggregation'; | ||
export { View, ViewOptions } from './view/View'; | ||
export { TimeoutError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TimeoutError = exports.View = exports.Aggregation = exports.SumAggregation = exports.LastValueAggregation = exports.HistogramAggregation = exports.DropAggregation = exports.ExplicitBucketHistogramAggregation = exports.DefaultAggregation = exports.MeterProvider = exports.InstrumentType = exports.ConsoleMetricExporter = exports.InMemoryMetricExporter = exports.PeriodicExportingMetricReader = exports.MetricReader = exports.DataPointType = exports.AggregationTemporality = void 0; | ||
exports.TimeoutError = exports.View = exports.Aggregation = exports.SumAggregation = exports.LastValueAggregation = exports.HistogramAggregation = exports.DropAggregation = exports.ExponentialHistogramAggregation = exports.ExplicitBucketHistogramAggregation = exports.DefaultAggregation = exports.MeterProvider = exports.InstrumentType = exports.ConsoleMetricExporter = exports.InMemoryMetricExporter = exports.PeriodicExportingMetricReader = exports.MetricReader = exports.DataPointType = exports.AggregationTemporality = void 0; | ||
var AggregationTemporality_1 = require("./export/AggregationTemporality"); | ||
@@ -39,2 +39,3 @@ Object.defineProperty(exports, "AggregationTemporality", { enumerable: true, get: function () { return AggregationTemporality_1.AggregationTemporality; } }); | ||
Object.defineProperty(exports, "ExplicitBucketHistogramAggregation", { enumerable: true, get: function () { return Aggregation_1.ExplicitBucketHistogramAggregation; } }); | ||
Object.defineProperty(exports, "ExponentialHistogramAggregation", { enumerable: true, get: function () { return Aggregation_1.ExponentialHistogramAggregation; } }); | ||
Object.defineProperty(exports, "DropAggregation", { enumerable: true, get: function () { return Aggregation_1.DropAggregation; } }); | ||
@@ -41,0 +42,0 @@ Object.defineProperty(exports, "HistogramAggregation", { enumerable: true, get: function () { return Aggregation_1.HistogramAggregation; } }); |
@@ -44,2 +44,3 @@ "use strict"; | ||
let delta = accumulation; | ||
// Diff with recorded cumulative memo. | ||
if (this._cumulativeMemoStorage.has(attributes, hashCode)) { | ||
@@ -51,2 +52,9 @@ // has() returned true, previous is present. | ||
} | ||
// Merge with uncollected active delta. | ||
if (this._activeCollectionStorage.has(attributes, hashCode)) { | ||
// has() returned true, previous is present. | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const active = this._activeCollectionStorage.get(attributes, hashCode); | ||
delta = this._aggregator.merge(active, delta); | ||
} | ||
// Save the current record and the delta record. | ||
@@ -53,0 +61,0 @@ this._cumulativeMemoStorage.set(attributes, accumulation, hashCode); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.10.1"; | ||
export declare const VERSION = "1.11.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '1.10.1'; | ||
exports.VERSION = '1.11.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
import { Aggregator, SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator } from '../aggregator'; | ||
import { Aggregator, SumAggregator, DropAggregator, LastValueAggregator, HistogramAggregator, ExponentialHistogramAggregator } from '../aggregator'; | ||
import { Accumulation } from '../aggregator/types'; | ||
@@ -16,2 +16,3 @@ import { InstrumentDescriptor } from '../InstrumentDescriptor'; | ||
static Histogram(): Aggregation; | ||
static ExponentialHistogram(): Aggregation; | ||
static Default(): Aggregation; | ||
@@ -61,2 +62,8 @@ } | ||
} | ||
export declare class ExponentialHistogramAggregation extends Aggregation { | ||
private readonly _maxSize; | ||
private readonly _recordMinMax; | ||
constructor(_maxSize?: number, _recordMinMax?: boolean); | ||
createAggregator(_instrument: InstrumentDescriptor): ExponentialHistogramAggregator; | ||
} | ||
/** | ||
@@ -63,0 +70,0 @@ * The default aggregation. |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DefaultAggregation = exports.ExplicitBucketHistogramAggregation = exports.HistogramAggregation = exports.LastValueAggregation = exports.SumAggregation = exports.DropAggregation = exports.Aggregation = void 0; | ||
exports.DefaultAggregation = exports.ExponentialHistogramAggregation = exports.ExplicitBucketHistogramAggregation = exports.HistogramAggregation = exports.LastValueAggregation = exports.SumAggregation = exports.DropAggregation = exports.Aggregation = void 0; | ||
const api = require("@opentelemetry/api"); | ||
@@ -41,2 +41,5 @@ const aggregator_1 = require("../aggregator"); | ||
} | ||
static ExponentialHistogram() { | ||
return EXPONENTIAL_HISTOGRAM_AGGREGATION; | ||
} | ||
static Default() { | ||
@@ -129,2 +132,13 @@ return DEFAULT_AGGREGATION; | ||
exports.ExplicitBucketHistogramAggregation = ExplicitBucketHistogramAggregation; | ||
class ExponentialHistogramAggregation extends Aggregation { | ||
constructor(_maxSize = 160, _recordMinMax = true) { | ||
super(); | ||
this._maxSize = _maxSize; | ||
this._recordMinMax = _recordMinMax; | ||
} | ||
createAggregator(_instrument) { | ||
return new aggregator_1.ExponentialHistogramAggregator(this._maxSize, this._recordMinMax); | ||
} | ||
} | ||
exports.ExponentialHistogramAggregation = ExponentialHistogramAggregation; | ||
/** | ||
@@ -162,3 +176,4 @@ * The default aggregation. | ||
const HISTOGRAM_AGGREGATION = new HistogramAggregation(); | ||
const EXPONENTIAL_HISTOGRAM_AGGREGATION = new ExponentialHistogramAggregation(); | ||
const DEFAULT_AGGREGATION = new DefaultAggregation(); | ||
//# sourceMappingURL=Aggregation.js.map |
{ | ||
"name": "@opentelemetry/sdk-metrics", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"description": "OpenTelemetry metrics SDK", | ||
@@ -80,4 +80,4 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/core": "1.10.1", | ||
"@opentelemetry/resources": "1.10.1", | ||
"@opentelemetry/core": "1.11.0", | ||
"@opentelemetry/resources": "1.11.0", | ||
"lodash.merge": "4.6.2" | ||
@@ -87,3 +87,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "486df99906958de9b8b666839785b00160a6a229" | ||
"gitHead": "1328ee04ae78f9f6cf143af7050c00aaa6d2eb3b" | ||
} |
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
1839857
561
21174
+ Added@opentelemetry/core@1.11.0(transitive)
+ Added@opentelemetry/resources@1.11.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.11.0(transitive)
- Removed@opentelemetry/core@1.10.1(transitive)
- Removed@opentelemetry/resources@1.10.1(transitive)
- Removed@opentelemetry/semantic-conventions@1.10.1(transitive)
Updated@opentelemetry/core@1.11.0