UNPKG

1.19 kBTypeScriptView Raw
1import type { MeasurementUnit, MetricBucketItem, Primitive } from '@sentry/types';
2import type { MetricType } from './types';
3/**
4 * Generate bucket key from metric properties.
5 */
6export declare function getBucketKey(metricType: MetricType, name: string, unit: MeasurementUnit, tags: Record<string, string>): string;
7/**
8 * Simple hash function for strings.
9 */
10export declare function simpleHash(s: string): number;
11/**
12 * Serialize metrics buckets into a string based on statsd format.
13 *
14 * Example of format:
15 * metric.name@second:1:1.2|d|#a:value,b:anothervalue|T12345677
16 * Segments:
17 * name: metric.name
18 * unit: second
19 * value: [1, 1.2]
20 * type of metric: d (distribution)
21 * tags: { a: value, b: anothervalue }
22 * timestamp: 12345677
23 */
24export declare function serializeMetricBuckets(metricBucketItems: MetricBucketItem[]): string;
25/** Sanitizes units */
26export declare function sanitizeUnit(unit: string): string;
27/** Sanitizes metric keys */
28export declare function sanitizeMetricKey(key: string): string;
29/**
30 * Sanitizes tags.
31 */
32export declare function sanitizeTags(unsanitizedTags: Record<string, Primitive>): Record<string, string>;
33//# sourceMappingURL=utils.d.ts.map
\No newline at end of file