forked from huksley/prometheus-remote-write
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
62 lines (55 loc) · 1.58 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/// <reference types="node" />
import { AwsCredentialIdentityProvider } from "@aws-sdk/types";
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[];
}
type MinimalFetch = (
url: string,
init?: {
method: string;
headers: { [key: string]: string };
timeout?: number;
body: ArrayBufferLike;
}
) => Promise<{ status: number; statusText: string; text: () => Promise<string> }>;
interface Options {
url?: string;
auth?: {
username?: string;
password?: string;
};
verbose?: boolean;
timing?: boolean;
proto?: string;
labels?: { [key: string]: string };
timeout?: number;
console?: Console;
fetch?: MinimalFetch;
awsAuth?: {
accessKeyId?: string;
secretAccessKey?: string;
} | AwsCredentialIdentityProvider
hostname?: string;
}
interface Result {
// Status 200 OK
status: number;
statusText: string;
errorMessage?: string;
}
/** Push timeseries entries to Prometheus */
export function pushTimeseries(timeseries: Timeseries | Timeseries[], options?: Options): Promise<Result>;
/** Push simpler key:value metrics to Prometheus, additional labels can be provided via options */
export function pushMetrics(metrics: Record<string, number>, options?: Options): Promise<Result>;