-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathtypes.d.ts
90 lines (74 loc) · 2.91 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import dgram = require("dgram");
declare module "hot-shots" {
export interface ClientOptions {
bufferFlushInterval?: number;
bufferHolder?: { buffer: string };
cacheDns?: boolean;
errorHandler?: (err: Error) => void;
globalTags?: string[];
globalize?: boolean;
host?: string;
isChild?: boolean;
maxBufferSize?: number;
mock?: boolean;
port?: number;
prefix?: string;
sampleRate?: number;
socket?: dgram.Socket;
suffix?: string;
telegraf?: boolean;
}
export interface ChildClientOptions {
globalTags?: string[];
prefix?: string;
suffix?: string;
}
export interface CheckOptions {
date_happened?: Date;
hostname?: string;
message?: string;
}
export interface DatadogChecks {
OK: 0;
WARNING: 1;
CRITICAL: 2;
UNKNOWN: 3;
}
type unionFromInterfaceValues4<
T,
K1 extends keyof T,
K2 extends keyof T,
K3 extends keyof T,
K4 extends keyof T,
> = T[K1] | T[K2] | T[K3] | T[K4];
export type DatadogChecksValues = unionFromInterfaceValues4<DatadogChecks, "OK", "WARNING", "CRITICAL", "UNKNOWN">;
export interface EventOptions {
aggregation_key?: string;
alert_type?: "info" | "warning" | "success" | "error";
date_happened?: Date;
hostname?: string;
priority?: "low" | "normal";
source_type_name?: string;
}
export type StatsCb = (error: Error | undefined, bytes: any) => void;
export type StatsCall = (stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb) => void;
export class StatsD {
constructor(options?: ClientOptions);
childClient(options?: ChildClientOptions): StatsD;
increment(stat: string): void;
increment(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
decrement(stat: string): void;
decrement(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
timing(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
histogram(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
gauge(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
set(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
unique(stat: string | string[], value: number, sampleRate?: number, tags?: string[], callback?: StatsCb): void;
close(callback: () => void): void;
event(title: string, text?: string, options?: EventOptions, tags?: string[], callback?: StatsCb): void;
check(name: string, status: DatadogChecksValues, options?: CheckOptions, tags?: string[], callback?: StatsCb): void;
public CHECKS: DatadogChecks;
}
}
declare const StatsDClient: StatsD;
export default StatsDClient;