Reporters

Cinnamon supports several Coda Hale Metrics reporters out-of-the-box. See the instructions below for enabling the Coda Hale Metrics plugin and configuring reporters.

Cinnamon dependency

First make sure that your build is configured to use the Cinnamon Agent.

Add the Coda Hale Metrics plugin dependency to your build:

sbt
libraryDependencies += Cinnamon.library.cinnamonCHMetrics
Maven
<dependency>
  <groupId>com.lightbend.cinnamon</groupId>
  <artifactId>cinnamon-chmetrics_2.11</artifactId>
  <version>2.5.0</version>
</dependency>
Gradle
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-chmetrics_2.11', version: '2.5.0'
}

JMX reporter

You need the Cinnamon dependency for Coda Hale Metrics.

Below is the configuration needed to set up Coda Hale Metrics to use the provided JMX reporter. The Reference tab shows all the configurable settings for the JMX reporter.

Required
cinnamon.chmetrics {
  reporters += "jmx-reporter"
}
Reference
cinnamon.chmetrics {
  jmx-reporter {

    # Time unit to convert rates to
    convert-rates-to = "SECONDS"

    # Time unit to convert durations to
    convert-durations-to = "MILLISECONDS"
  }
}

Note: These settings are defined in the reference.conf. You only need to specify any of these settings when you want to override the defaults.

JMX properties

For more information on configuring JMX properties, see the JMX documentation for Java.

To include properties in an sbt-native-packager distribution, you can use bash script defines or bat script defines.

Note: Enabling remote JMX can be a security risk. See the JMX documentation for Java for how to configure security. For more information about possible exploits, this blog post describes exploiting JMX RMI.

Console reporter

You need the Cinnamon dependency for Coda Hale Metrics.

Below is the configuration needed to set up Coda Hale Metrics to use the provided Console reporter. The Reference tab shows all the configurable settings for the Console reporter.

Required
cinnamon.chmetrics {
  reporters += "console-reporter"
}
Reference
cinnamon.chmetrics {
  console-reporter {

    # Time unit to convert rates to
    convert-rates-to = "SECONDS"

    # Time unit to convert durations to
    convert-durations-to = "MILLISECONDS"

    # Format numbers for this locale
    formatted-for = "en"

    # Frequency with which to report metrics
    frequency = 5s
  }
}

Note: These settings are defined in the reference.conf. You only need to specify any of these settings when you want to override the defaults.

SLF4J reporter

You need the Cinnamon dependency for Coda Hale Metrics.

Below is the configuration needed to set up Coda Hale Metrics to use the provided SLF4J reporter. The Reference tab shows all the configurable settings for the SLF4J reporter.

Required
cinnamon.chmetrics {
  reporters += "slf4j-reporter"
}
Reference
cinnamon.chmetrics {
  slf4j-reporter {

    # Time unit to convert rates to
    convert-rates-to = "SECONDS"

    # Time unit to convert durations to
    convert-durations-to = "MILLISECONDS"

    # Logger name to output to
    output-to = "output-sink"

    # Frequency with which to report metrics
    frequency = 5s
  }
}

Note: These settings are defined in the reference.conf. You only need to specify any of these settings when you want to override the defaults.

HTTP reporter

The HTTP reporter requires an extra dependency. First add the HTTP reporter dependency to your build:

sbt
libraryDependencies += Cinnamon.library.cinnamonCHMetricsHttpReporter
Maven
<dependency>
  <groupId>com.lightbend.cinnamon</groupId>
  <artifactId>cinnamon-chmetrics-http-reporter_2.11</artifactId>
  <version>2.5.0</version>
</dependency>
Gradle
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-chmetrics-http-reporter_2.11', version: '2.5.0'
}

Below is the configuration needed to set up Coda Hale Metrics to use the provided HTTP reporter. The Reference tab shows all the configurable settings for the HTTP reporter.

Required
cinnamon.chmetrics {
  reporters += "http-reporter"
}
Example
cinnamon.chmetrics {
  reporters += "http-reporter"

  http-reporter {
    host = "127.0.0.1"
    port = 8888
  }
}
Reference
cinnamon.chmetrics {
  http-reporter {

    # Time unit to convert rates to
    convert-rates-to = "SECONDS"

    # Time unit to convert durations to
    convert-durations-to = "MILLISECONDS"

    # Frequency with which to report metrics
    frequency = 5s

    # Interface accept connections on
    host = "127.0.0.1"

    # Port to accept connections on
    port = 8080

    # Configuration of the actor system used by the http reporter
    reporter-actor-system {
      akka.instrumentations = []
      akka.http.instrumentations = []
    }
  }
}

Note: These settings are defined in the reference.conf. You only need to specify any of these settings when you want to override the defaults.

The reporter-actor-system is the configuration used when starting a required ActorSystem for the HTTP reporter. With this configuration you can fine tune the configuration of this ActorSystem based on your underlying hardware. Please note that this reporter should not require a lot of resources so using the default settings may be overkill.

Note: The HTTP reporter only supports Akka 2.4 and greater.

Multiple reporters

It is also possible to set up multiple reporters, provided or custom, to report to several places. Below is an example of how to use the JMX and Console reporters simultaneously:

cinnamon.chmetrics {
  reporters += "console-reporter"
  reporters += "jmx-reporter"
}