This play module provides some support for @codahale Metrics library in a Play2 application (Scala). It allows you to get insights about the state of your application, for example how response times behave, with which HTTP codes your service responds, how many log entries are written.
The name stems from the german mining term Markscheider, which was a land surveyor who was responsible for mapping of the mine.
Add metrics-play dependency in your
libraryDependencies += Seq( "org.zalando" %% "markscheider" % "2.7.1" )
To enable the plugin, add to
play.modules.enabled += "org.zalando.markscheider.PlayMetricsModule"
Then add the metrics filter to your filter chain in
play.filters.enabled += "org.zalando.markscheider.MetricsFilter"
You may want to have an endpoint that delivers the metrics, which you can add via
GET /metrics org.zalando.markscheider.MetricsController.metrics
The metrics are created in a way that is compatible with ZMON by default.
You can get Prometheus-compatible metrics as well by explicitly asking for
Accept header or configuring
org.zalando.markscheider.defaultFormat = "prometheus"
After that, you can get metrics information in your service at
/metrics. By default, that endpoint is unsecured (no authentication in place).
For an example output of the endpoint, see
The basic configuration is supported through the default configuration file, see
conf/reference.conf. You can override
the settings in your
application.conf. Otherwise the default settings are used.
Note: the namespace for the configuration is
We welcome contributions. See CONTRIBUTIONS.md for details.
This lib was adapted from https://github.com/fr3akX/metrics-play, which contains code from other sources as well.
This code is released under the Apache Public License 2.0.