-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathmetrics.ts
45 lines (40 loc) · 1.34 KB
/
metrics.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { MetricData } from '@sentry/core';
import { BrowserMetricsAggregator, metrics as metricsCore } from '@sentry/core';
/**
* Adds a value to a counter metric
*
* @experimental This API is experimental and might have breaking changes in the future.
*/
function increment(name: string, value: number = 1, data?: MetricData): void {
metricsCore.increment(BrowserMetricsAggregator, name, value, data);
}
/**
* Adds a value to a distribution metric
*
* @experimental This API is experimental and might have breaking changes in the future.
*/
function distribution(name: string, value: number, data?: MetricData): void {
metricsCore.distribution(BrowserMetricsAggregator, name, value, data);
}
/**
* Adds a value to a set metric. Value must be a string or integer.
*
* @experimental This API is experimental and might have breaking changes in the future.
*/
function set(name: string, value: number | string, data?: MetricData): void {
metricsCore.set(BrowserMetricsAggregator, name, value, data);
}
/**
* Adds a value to a gauge metric
*
* @experimental This API is experimental and might have breaking changes in the future.
*/
function gauge(name: string, value: number, data?: MetricData): void {
metricsCore.gauge(BrowserMetricsAggregator, name, value, data);
}
export const metrics = {
increment,
distribution,
set,
gauge,
};