I was looking for replacement of yammer-metrics plugin for Grails 3.x & found Grails Dropwizard Metrics for the same.
I was trying to integrate it with my sample application(in Grails 3.x) and was following the documentation given at : http://grails-plugins.github.io/grails-dropwizard-metrics/snapshot/index.html#_healthcheck_beans
Following the blog, I have added below dependencies in build.gradle i.e
compile "org.grails.plugins:dropwizard-metrics:1.0.0.BUILD-SNAPSHOT"
And to test this, I made TestController with index() action i.e
import grails.plugin.dropwizard.metrics.timers.Timed
class TestController {
@Timed('test1')
def index() {
render 'ok'
}
}
With this, running the application and hitting /test/index and then /metrics, No longer returns a valid JSON, containing version, gaugues, counters, timers tag etc. (as seen in http://grails-plugins.github.io/grails-dropwizard-metrics/snapshot/index.html#_exposing_metrics_data)
Instead it just returns JSON in this format:
{
"mem": 830779,
"mem.free": 602088,
"processors": 4,
"instance.uptime": 14766,
"uptime": 30991,
"systemload.average": -1.0,
"heap.committed": 749056,
"heap.init": 786432,
"heap.used": 146967,
"heap": 749056,
"nonheap.committed": 84896,
"nonheap.init": 2496,
"nonheap.used": 81724,
"nonheap": 0,
"threads.peak": 33,
"threads.daemon": 29,
"threads.totalStarted": 37,
"threads": 32,
"classes": 11057,
"classes.loaded": 11057,
"classes.unloaded": 0,
"gc.ps_scavenge.count": 18,
"gc.ps_scavenge.time": 490,
"gc.ps_marksweep.count": 3,
"gc.ps_marksweep.time": 854,
"test1.snapshot.stdDev": 0,
"gauge.response.test.test1": 335.0,
"gauge.response.assets.bootstrap.js": 76.0,
"test1.snapshot.98thPercentile": 31,
"counter.status.200.assets.grails.css": 1,
"gauge.response.assets.jquery-2.2.0.min.js": 146.0,
"test1.snapshot.999thPercentile": 31,
"counter.status.200.test.test1": 1,
"gauge.response.assets.grails-cupsonly-logo-white.svg": 3.0,
"test1.fifteenMinuteRate": 0.2,
"test1.snapshot.min": 31,
"test1.snapshot.95thPercentile": 31,
"test1.meanRate": 0.18974713564659287,
"gauge.response.assets.favicon.ico": 8.0,
"gauge.response.assets.mobile.css": 129.0,
"gauge.response.root": 2301.0,
"counter.status.200.root": 1,
"counter.status.200.assets.jquery-2.2.0.min.js": 1,
"counter.status.200.assets.application.css": 1,
"gauge.response.assets.main.css": 148.0,
"test1.snapshot.mean": 31,
"test1.snapshot.99thPercentile": 31,
"counter.status.200.assets.main.css": 1,
"gauge.response.assets.application.css": 152.0,
"counter.status.200.assets.mobile.css": 1,
"counter.status.200.assets.grails-cupsonly-logo-white.svg": 1,
"test1.snapshot.median": 31,
"gauge.response.assets.grails.css": 145.0,
"counter.status.200.assets.bootstrap.js": 1,
"test1.count": 1,
"test1.oneMinuteRate": 0.2,
"test1.fiveMinuteRate": 0.2,
"test1.snapshot.max": 31,
"test1.snapshot.75thPercentile": 31,
"gauge.response.assets.application.js": 4.0,
"counter.status.200.assets.favicon.ico": 2,
"counter.status.200.assets.application.js": 1,
"gauge.response.assets.bootstrap.css": 249.0,
"counter.status.200.assets.bootstrap.css": 1,
"httpsessions.max": -1,
"httpsessions.active": 0
}
In my sample application, I had tried to register MetricRegistry bean in resources.groovy too like below:
beans = { metricRegistry(MetricRegistry) }
But still the output JSON is same.
Please let me what I am missing. Thanks in advance!