UNPKG

1.6 kBTypeScriptView Raw
1import type { Client, ClientOptions, MeasurementUnit, MetricsAggregator as MetricsAggregatorBase, Primitive } from '@sentry/types';
2import type { MetricType } from './types';
3/**
4 * A metrics aggregator that aggregates metrics in memory and flushes them periodically.
5 */
6export declare class MetricsAggregator implements MetricsAggregatorBase {
7 private readonly _client;
8 private _buckets;
9 private _bucketsTotalWeight;
10 private readonly _interval;
11 private readonly _flushShift;
12 private _forceFlush;
13 constructor(_client: Client<ClientOptions>);
14 /**
15 * @inheritDoc
16 */
17 add(metricType: MetricType, unsanitizedName: string, value: number | string, unsanitizedUnit?: MeasurementUnit, unsanitizedTags?: Record<string, Primitive>, maybeFloatTimestamp?: number): void;
18 /**
19 * Flushes the current metrics to the transport via the transport.
20 */
21 flush(): void;
22 /**
23 * Shuts down metrics aggregator and clears all metrics.
24 */
25 close(): void;
26 /**
27 * Flushes the buckets according to the internal state of the aggregator.
28 * If it is a force flush, which happens on shutdown, it will flush all buckets.
29 * Otherwise, it will only flush buckets that are older than the flush interval,
30 * and according to the flush shift.
31 *
32 * This function mutates `_forceFlush` and `_bucketsTotalWeight` properties.
33 */
34 private _flush;
35 /**
36 * Only captures a subset of the buckets passed to this function.
37 * @param flushedBuckets
38 */
39 private _captureMetrics;
40}
41//# sourceMappingURL=aggregator.d.ts.map
\No newline at end of file