Table of Contents
List of Examples
statsd_set
usagestatsd_set
usagestatsd_start
usagestatsd_stop
usagestatsd_incr
usagestatsd_decr
usageTable of Contents
The module provides the ability to send commands to statsd (you can use InfluxDB too) with different kind of information. It provides native integration with statsd (https://github.com/etsy/statsd/) and graphite (http://graphite.wikidot.com/).
The module does not have any special dependency, it does a direct socket connection to Graphite.
Statsd server ip
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); ... } ...
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)"); }
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"); ...
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"); ...