This modules enables a dropwizard application to send metrics to an elasticsearch instance.
What about Metrics Elasticsearch Reporter? Doesn't it do just that?
No, it doesn't. As outlined here, it needs you to write some code in your application. This module adds the ability to perform that task through your dropwizard application yaml configuration. In fact, under the hood it actually makes use of Metrics Elasticsearch Reporter to perform the work.
- add this jar as a dependency to the dropwizard app:
<dependencies>
../..
<dependency>
<groupId>org.dhatim.io.dropwizard</groupId>
<artifactId>dropwizard-metrics-elasticsearch</artifactId>
<version>1.0.8</version>
</dependency>
../..
</dependencies>
- enable the metrics reporter through the configuration:
metrics:
reporters:
- type: elasticsearch
and you're good to go.
The configuration is somewhat limited right now:
- servers: you can configure a set of elasticsearch nodes with the
servers
key, which hold a collection ofhost
andport
keys. - prefix: useful to identify single hosts.
- index: elasticsearch index name.
- indexDateFormat: elasticsearch index date format.
- additionalFields: optional map of additional field values.
metrics:
reporters:
- type: elasticsearch
servers:
- host: localhost
port: 9200
prefix:
index: metrics
indexDateFormat: yyyy.MM.dd
additionalFields:
It should basically follow the Metrics Elasticsearch Reporter defaults.