statr (pronounced statter) is a tool for collecting, aggregating, reporting and reacting to application metrics. It is similar to tools like graphite (with statsd) and munin and uses many of the same terminology and even, in some cases, the same file and wire formats.
An application level event is a metric that is generated by your application. Examples could be:
- A user signs up
- An unhandled exception occurs
- A user logs in
- A user fails to login
- A server processes an incoming email
- The time it takes for a incoming email to be processes
- The number of current active users
Currently there is only one application level event that is the count event. This is used to keep track of events that should be aggregated by using addition. For example, the number of signups, or the number of unhandled exceptions.
There is currently only one way to send an event to the application and that is via the Statr.Client. It uses a very simple wire format which is identical to statsd. Here's how you would send a count metric:
// Create a client pointing to local host
var client = StatrClient.Build("localhost");
// Send the count metric
client.Count("stats.user.signups");
// send a gauge meric
client.Gauge("stats.engine.gas.remaining", 50);
If you want metrics from your app you'll need to modify it, however if all you want to do is send some metrics then you can use the interactive console. With the interactive console you send metrics like this:
<name> <type> <num> <interval> <value>
For example:
stats.sample.merics count 1000 50 5
This will send 1000 count metrics with the name 'stats.sample.metrics' ever 50ms with the value of 5.
I'd love if you could contribute. You could:
- Add a metric type
- Add a aggreagation type
- Write examples and documentation!
However, if you're going to contribute please make sure you write tests for any new functionality or bug fixes. Adding an example is also great!