I have recently done some work around adding metrics to a dropwizard application using influxDB and Grafana. My experience with it has been mixed. I'm used to reporting via Graphite/StatsD and so far, the influxDB solution just isn't cutting the mustard. First off, adding metrics to dropwizard.
Add this to your dropwizard "yaml" file (we're using the graphite reporter):
metrics: reporters: - type: graphite host: localhost port: 2003 prefix: dev.your-app durationUnit: milliseconds frequency: 10 second
Next, setup your dropwizard app so you can easily reuse the config for custom metrics:
Add this line to your "main" class:
public static MetricRegistry metrics = new MetricRegistry();
and initialise the registry in your "run" method using:
metrics = environment.metrics();
Now you can use the registry to add whatever details you want. I created an interface with the content below, then implement and use the counter:
public String prefix = "some.failure"; final Counter counter = MyMainClass.metrics.counter(prefix + new-request"); }
Now, turning this into something reasonable in Grafana. This is where things got slightly more complex. Plotting the rate of change of a metric over time periods isn't quite there yet in influxDB. You can plot an increasing metric easily, sum of metrics is quite straightforward.
Unfortunately moving average metrics and integrals are not available yet. This makes most of what I like to see on graphs impossible. InfluxDB claims to be more performant and uses all cores when accessing data (allegedly getting over Python issues experienced with Whisper, the "normal" graphite database choice). I haven't seen performance issues on the applications I've worked with (peaks of 100 requests per second).
Hopefully this can get sorted soon as retrofitting the Graphite/ElasticSearch components is a ball ache for the devOps guys!