forked from huksley/prometheus-remote-write
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
37 lines (32 loc) · 1004 Bytes
/
types.d.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
/// <reference types="node" />
interface Sample {
value: number;
timestamp?: number;
}
interface Timeseries {
// Labels for every sample
labels: {
// Key for sample, should end with _totals, etc, see https://prometheus.io/docs/practices/naming/
__name__: string;
// Optional properties, i.e. instance, job, service
[key: string]: string;
};
// List of samples, timestamp is optional, will be set by pushTimeseries
samples: Sample[];
}
interface Options {
url?: string;
auth?: {
username?: string;
password?: string;
};
verbose?: boolean;
timing?: boolean;
proto?: string;
labels?: { [key: string]: string };
fetch?: typeof fetch
}
/** Push timeseries entries to Prometheus */
export function pushTimeseries(timeseries: Timeseries | Timeseries[], options?: Options);
/** Push simpler key:value metrics to Prometheus, additional labels can be provided via options */
export function pushMetrics(metrics: Record<string, number>, options?: Options);