Skip to content

dhatim/dropwizard-metrics-elasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dropwizard Metrics Support for Elastic Search

Build Status Maven Central

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.

How to

  • 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.

configuration

The configuration is somewhat limited right now:

  • servers: you can configure a set of elasticsearch nodes with the servers key, which hold a collection of host and port keys.
  • prefix: useful to identify single hosts.
  • index: elasticsearch index name.
  • indexDateFormat: elasticsearch index date format.
  • additionalFields: optional map of additional field values.

default 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.