-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
200 lines (140 loc) · 4.23 KB
/
README
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
Statsd Module
Eloy Coto Pereiro
Edited by
Eloy Coto Pereiro
Copyright © 2014 Eloy Coto
__________________________________________________________________
Table of Contents
1. Admin Guide
1. Overview
2. Parameters
2.1. ip(string)
2.2. port(int)
3. Functions
3.1. statsd_set(key, value)
3.2. statsd_gauge(key, value)
3.3. statsd_start(key)
3.4. statsd_stop(key)
3.5. statsd_incr(key)
3.6. statsd_decr(key)
List of Examples
1.1. Set ip parameter
1.2. Set ip parameter
1.3. statsd_set usage
1.4. statsd_set usage
1.5. statsd_start usage
1.6. statsd_stop usage
1.7. statsd_incr usage
1.8. statsd_decr usage
Chapter 1. Admin Guide
Table of Contents
1. Overview
2. Parameters
2.1. ip(string)
2.2. port(int)
3. Functions
3.1. statsd_set(key, value)
3.2. statsd_gauge(key, value)
3.3. statsd_start(key)
3.4. statsd_stop(key)
3.5. statsd_incr(key)
3.6. statsd_decr(key)
1. Overview
This is the overview for the module statsd of kamailio
2. Parameters
2.1. ip(string)
2.2. port(int)
2.1. ip(string)
Statsd server ip
Example 1.1. Set ip parameter
...
modparam("statsd", "ip", "127.0.0.1")
...
2.2. port(int)
Statsd server ip
Example 1.2. Set ip parameter
...
modparam("statsd", "port", "8125")
...
3. Functions
3.1. statsd_set(key, value)
3.2. statsd_gauge(key, value)
3.3. statsd_start(key)
3.4. statsd_stop(key)
3.5. statsd_incr(key)
3.6. statsd_decr(key)
3.1. statsd_set(key, value)
Sets count the number of unique values passed to a key.
If that method is called multiple times with the same userid in the
same sample period, that userid will only be counted once.
This function can be used in ALL ROUTES.
Example 1.3. statsd_set usage
...
failure_route[tryagain] {
...
statsd_set("customerFailure", 1);
...
}
...
3.2. statsd_gauge(key, value)
Gauges are a constant data type. They are not subject to averaging, and
they donât change unless you change them. That is, once you set a
gauge value, it will be a flat line on the graph until you change it
again.
Gauges are useful for things that are already averaged, or donât need
to reset periodically
This function can be used in ALL ROUTES.
The statsd server collects gauges under the stats.gauges prefix.
Example 1.4. statsd_set usage
route [gauge_method]{
statsd_gauge("method"+$rm, "+1");
statsd_gauge("customer_credit"+$var(customer),"$var(customer_credit)");
}
3.3. statsd_start(key)
statsd start set a avp with the key name, and when you use
statsd_stop(key), module will send to statsd the difference in
milliseconds. this is useful to know the time of a sql query, or how
many time take your replies.
this function can be used in all routes.
the statsd server collects all timers under the stats.timers prefix,
and will calculate the lower bound, mean, 90th percentile, upper bound,
and count of each timer for each period (by the time you see it in
graphite, thatâs usually per minute).
Example 1.5. statsd_start usage
...
statsd_start("long_mysql_query");
sql_query("ca", "select sleep(0.2)", "ra");
statsd_stop("long_mysql_query");
...
3.4. statsd_stop(key)
statsd_stop(key) get the avp string with the key and calculate the
difference from the start time. When finish app send the milliseconds
to statsd.
This function can be used in all routes.
Example 1.6. statsd_stop usage
...
statsd_start("long_mysql_query");
sql_query("ca", "select sleep(0.2)", "ra");
statsd_stop("long_mysql_query");
...
3.5. statsd_incr(key)
Increment a counter
This function can be used in all routes.
Example 1.7. statsd_incr usage
...
if(geoip_match("$si", "src")){
statsd_incr("country."+$(gip(src=>cc)));
}
...
3.6. statsd_decr(key)
Decrement a counter
This function can be used in all routes.
Example 1.8. statsd_decr usage
...
if (t_check_status("408")) {
statsd_decr("kamailio.successfulCalls");
statsd_incr("kamailio.reply.busy");
}
...