Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Latest commit

 

History

History
65 lines (52 loc) · 2.22 KB

README.md

File metadata and controls

65 lines (52 loc) · 2.22 KB

Metrics Datadog Reporter

Simple Metrics reporter backend that sends metrics to DataDog.

[DEPRECATED]

This project is in the process of being deprecated. If you would like to use this project, all features here have been merged to Coursera's fork. Coursera's fork has also been released to Maven Central.

Usage

import com.codahale.metrics.datadog.DatadogReporter

final Datadog datadog = new Datadog(apiKey, applicationKey)
final DatadogReporter reporter = DatadogReporter.forRegistry(registry)
                                                .filter(MetricFilter.ALL)
                                                .build(datadog);

reporter.start(1, TimeUnit.MINUTES);

The hostname provided with each publish needs to match the hostname defined in the /etd/dd-agent/datadog.conf file that configures the DataDog agent. This is so that the metrics being pushed directly to datadog via this library can be associated with other (box-level) metrics being pushed by the agent.

Dropwizard Metrics Reporter

If you have a dropwizard project and have at least dropwizard-core 0.7.X, then you can just add this to your dropwizard YAML configuration file.

metrics:
  frequency: 1 minute                       # Default is 1 second.
  reporters:
    - type: datadog
      host: <host>
      tags: <tags>                          # Optional.
      apiKey: <apiKey>
      applicationKey: <applicationKey>      # Optional
      includes:                             # Optional. Defaults to (all).
      excludes:                             # Optional. Defaults to (none).

If you want to whitelist only a few metrics, you can use the includes key to create a set of metrics to include.

metrics:
  frequency: 1 minute                       # Default is 1 second.
  reporters:
    - type: datadog
      host: <host>
      tags: <tags>
      apiKey: <apiKey>
      applicationKey: <applicationKey>      # Optional
      includes:
        - jvm.
        - ch.
        

The check is very simplistic so be as specific as possible. For example, if you have "jvm.", the filter will check if the includes has that value in any part of the metric name (not just the beginning).