-
Notifications
You must be signed in to change notification settings - Fork 16
/
hot-shots.node.txt
159 lines (117 loc) · 9.38 KB
/
hot-shots.node.txt
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
HOT-SHOTS
ALTERNATIVES ==> #See statsd-client
NATIVE MODULE ==> #A native module is installed as optionalDependencies for UDS support
VERSION ==> #10.0.0
/=+===============================+=\
/ : : \
)==: GENERAL :==(
\ :_______________________________: /
\=+===============================+=/
new HotShots([OPTS])->CLIENT #
CLIENT.ChildClient([OPTS]) #Clone and inherits from parent
->CLIENT2 #Can override only OPTS.errorHandler|prefix|suffix|globalTags
OPTS.globalize #BOOL (def: false). Sets global.statsd = CLIENT
/=+===============================+=\
/ : : \
)==: CONNECTION :==(
\ :_______________________________: /
\=+===============================+=/
OPTS.protocol #'udp' (def), 'uds', 'tcp' or 'stream'
#statsd server protocol
OPTS.host #STR (def: ENVVAR DD_AGENT_HOST, or '127.0.0.1'|'::1') (for UDP|UDS|TCP)
#UDS is like UDP but using a socket file path
OPTS.useDefaultRoute #BOOL (def: false).
#Set OPTS.host to machine's IP (e.g. "192.168.1.1" on my machine).
#Uses /proc/net/route, finding one with destination 00000000
OPTS.port #STR (def: ENVVAR DD_DOGSTATSD_PORT, or 8125) (for UDP|UDS|TCP)
OPTS.cacheDns #BOOL (def: false) (UDP only)
#Caches DNS lookup of host
OPTS.cacheDnsTtl #NUM (in ms, def: 1 minute)
#How long to cache DNS
OPTS.stream #STREAM with BUFFER chunks receiving events and packages ('stream' only)
OPTS.path #Socket 'PATH' (UDS only) (def: '/var/run/datadog/dsd.socket')
OPTS.udpSocketOptions #OBJ passed to DGRAM.createSocket() (UDP only)
OPTS.tcp|udsGracefulErrorHandling #BOOL (def: true)
#On ECONNREFUSED|ECONNRESET, re-create sockets
OPTS. #NUM (in ms, def: 1s)
tcp|udsGracefulRestartRateLimit #Throttles socket re-creation
OPTS.errorHandler(ERROR) #Fired on transport ERROR
OPTS.mock #BOOL (def: false)
#Instead of using transports, add them to CLIENT.mockBuffer BUFFER_ARR
OPTS.bufferFlushInterval #NUM (in ms, def: 1s)
#Buffer messages and flush them every NUMms
OPTS.maxBufferSize #NUM (def: 0)
#If buffer above that size, force flush
OPTS.closingFlushInterval #NUM (in ms, def: 50)
#On close, wait for messages currently being sent.
#Wait for it 10 times with NUMms intervals
/=+===============================+=\
/ : : \
)==: MESSAGES :==(
\ :_______________________________: /
\=+===============================+=/
OPTS.prefix #STR (def: ''). Prefixed to every MNAME
OPTS.suffix #STR (def: ''). Suffixed to every NAME
OPTS.sampleRate #SAMPLE_RATE NUM (def: 1)
#Default sample rate.
#Used to randomly drop metrics. Does not multiply the metrics value.
OPTS.globalTags #Tags added to every message
#If ENVVAR:
# - DD_ENTITY_ID set -> add "dd.internal.entity_id:DD_ENTITY_ID" to them
# - DD_ENV -> "env"
# - DD_SERVICE -> "service"
# - DD_VERSION -> "version"
TAGS #Either:
# - 'KEY:VAL'_ARR
# - OBJ:
# - use each KEY|VAL
# - replace any :|,@ with _
OPTS.tagPrefix #STR (def: '#'). Used to prefix tags in statsd messages
OPTS.tagSeparator #STR (def: ','). Used to separate tags in statsd messages
/=+===============================+=\
/ : : \
)==: METRICS :==(
\ :_______________________________: /
\=+===============================+=/
CLIENT.timing('MNAME'[_ARR], #Send "ms" metrics
NUM|DATE[, SAMPLE_RATE][, TAGS] #If DATE, use difference from now
[, FUNC(ERROR, NUM2)]) #FUNC() is when done sending. NUM2 is number of sent bytes
CLIENT.increment(...) #Like CLIENT.timing() except NUM defaults to 1
CLIENT.decrement(...) #Like CLIENT.timing() except NUM defaults to -1 and NUM is always negative
CLIENT.gauge(...) #Like CLIENT.timing() but for "g" metrics
CLIENT.set|unique(...) #Like CLIENT.timing() but for "s" metrics
CLIENT.timer(FUNC, ...)->FUNC2 #Wrap FUNC so that it calls CLIENT.timing(...) with NUM being the time the FUNC ran
CLIENT.asyncTimer(FUNC,...)->FUNC2#Same but for async FUNC
CLIENT.asyncDistTimer(FUNC,...)
->FUNC2 #Same but using CLIENT.distribution(...)
/=+===============================+=\
/ : : \
)==: DOGSTATSD :==(
\ :_______________________________: /
\=+===============================+=/
CLIENT.histogram(...) #Like CLIENT.timing() but for "h" metrics
CLIENT.distribution(...) #Like CLIENT.timing() but for "d" metrics
CLIENT.check(...) #Like CLIENT.timing() but for service checks:
# - NUM must be 0-3
# - instead of SAMPLE_RATE, OPTS2:
# - date_happened DATE|NUM: timestamp
# - hostname 'HOSTNAME'
CLIENT.event(...) #Like CLIENT.timing() but for service checks:
# - MNAME is 'TITLE' instead
# - NUM must be 'MESSAGE' instead
# - instead of SAMPLE_RATE, OPTS2:
# - date_happened DATE|NUM: timestamp
# - hostname 'HOSTNAME'
# - aggregation_key STR
# - priority STR
# - source_type_name STR
# - alert_type STR
/=+===============================+=\
/ : : \
)==: TELEGRAF :==(
\ :_______________________________: /
\=+===============================+=/
OPTS.telegraf #BOOL (def: false)
#Does some syntax difference for InfluxDB's statsd server: "MNAME,[TAG=VAL,...]:UINT|TYPE"