UNPKG

1.99 kBTypeScriptView Raw
1import type { Client, MetricData, MetricsAggregator as MetricsAggregatorInterface } from '@sentry/types';
2type MetricsAggregatorConstructor = {
3 new (client: Client): MetricsAggregatorInterface;
4};
5/**
6 * Gets the metrics aggregator for a given client.
7 * @param client The client for which to get the metrics aggregator.
8 * @param Aggregator Optional metrics aggregator class to use to create an aggregator if one does not exist.
9 */
10declare function getMetricsAggregatorForClient(client: Client, Aggregator: MetricsAggregatorConstructor): MetricsAggregatorInterface;
11/**
12 * Adds a value to a counter metric
13 *
14 * @experimental This API is experimental and might have breaking changes in the future.
15 */
16declare function increment(aggregator: MetricsAggregatorConstructor, name: string, value?: number, data?: MetricData): void;
17/**
18 * Adds a value to a distribution metric
19 *
20 * @experimental This API is experimental and might have breaking changes in the future.
21 */
22declare function distribution(aggregator: MetricsAggregatorConstructor, name: string, value: number, data?: MetricData): void;
23/**
24 * Adds a value to a set metric. Value must be a string or integer.
25 *
26 * @experimental This API is experimental and might have breaking changes in the future.
27 */
28declare function set(aggregator: MetricsAggregatorConstructor, name: string, value: number | string, data?: MetricData): void;
29/**
30 * Adds a value to a gauge metric
31 *
32 * @experimental This API is experimental and might have breaking changes in the future.
33 */
34declare function gauge(aggregator: MetricsAggregatorConstructor, name: string, value: number, data?: MetricData): void;
35export declare const metrics: {
36 increment: typeof increment;
37 distribution: typeof distribution;
38 set: typeof set;
39 gauge: typeof gauge;
40 /**
41 * @ignore This is for internal use only.
42 */
43 getMetricsAggregatorForClient: typeof getMetricsAggregatorForClient;
44};
45export {};
46//# sourceMappingURL=exports.d.ts.map
\No newline at end of file