Publishing Play Web Application Metrics to InfluxDB

metrics-play which is a fork of metrics-play project can be used to publish Play web application metrics including JVM metrics to InfluxDB via Graphite protocol.

To add support for publishing Play application metrics to InfluxDB, first you have to add metrics-play with Graphite reporter into you Play app dependencies like below:

libraryDependencies ++= Seq(
  "com.kenshoo" %% "metrics-play" % "2.3.0_0.2.1-graphite",
  javaJdbc,
  javaEbean,
  cache,
  javaWs
)

And then you have to add the Play plugin com.kenshoo.play.metrics.MetricsPlugin to your play.plugins file. Then in the Play application configuration, you can enable and configure the Graphite reporter like below:

metrics {
  graphite {
    enabled = true
    period = 1
    unit = MINUTES
    host = localhost
    port = 2003
  }
}

Above steps assume that you have configured InfluxDB Graphite input plugin like below.

[input_plugins]

  # Configure the graphite api
  [input_plugins.graphite]
  enabled = true
  # address = "0.0.0.0" # If not set, is actually set to bind-address.
  port = 2003
  database = "play-influxdb"  # store graphite data in this database
  udp_enabled = true # enable udp interface on the same port as the tcp interface

Current implementation of this plugin doesn’t support route level metrics. I am hoping to add them based on StatsD plugin for Play.

 
10
Kudos
 
10
Kudos

Now read this

Clojure Magic: proxy and proxy-super

Clojure is fun and Clojure macros are even more fun to use and really useful for developing domain specific languages. You can do amazing things using macros once you get used to them. This post describes how we can use Clojure proxy and... Continue →