Skip to content

Commit 94f1b89

Browse files
committedApr 22, 2015
Merge pull request #34 from kenshoo/prefix-jvm-metrics
standardize jvm metric names with dropwizard fixes #31
2 parents 4cf897a + cd75da2 commit 94f1b89

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed
 

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ created metrics, and to specify which HTTP Status codes should have individual m
112112
2.3.0_0.1.8 - Support default registry in play java. Replace MetricsRegistry.default with MetricsRegistry.defaultRegistry (to support java where default is a reserved keyword)
113113
2.3.0_0.1.9 - Add extra http codes, support configurable metrics names for requests filter
114114
2.3.0_0.2.0 - Meter uncaught exceptions as 500 Internal Server Error
115+
2.3.0_0.2.1 - Breaking Change! prefix jvm metric names to standardize with dropwizard
116+
115117

116118
## License
117119
This code is released under the Apache Public License 2.0.

‎build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ organization:= "com.kenshoo"
22

33
name := "metrics-play"
44

5-
version := "2.3.0_0.2.0"
5+
version := "2.3.0_0.2.1"
66

77
scalaVersion := "2.11.2"
88

‎src/main/scala/com/kenshoo/play/metrics/MetricsPlugin.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import ch.qos.logback.classic
2121
import com.codahale.metrics.logback.InstrumentedAppender
2222
import play.api.{Logger, Application, Play, Plugin}
2323

24-
import com.codahale.metrics.{MetricRegistry, SharedMetricRegistries}
24+
import com.codahale.metrics.{JvmAttributeGaugeSet, MetricRegistry, SharedMetricRegistries}
2525
import com.codahale.metrics.json.MetricsModule
2626
import com.codahale.metrics.jvm.{ThreadStatesGaugeSet, GarbageCollectorMetricSet, MemoryUsageGaugeSet}
2727

@@ -53,9 +53,10 @@ class MetricsPlugin(val app: Application) extends Plugin {
5353
def setupJvmMetrics(registry: MetricRegistry) {
5454
val jvmMetricsEnabled = app.configuration.getBoolean("metrics.jvm").getOrElse(true)
5555
if (jvmMetricsEnabled) {
56-
registry.registerAll(new GarbageCollectorMetricSet())
57-
registry.registerAll(new MemoryUsageGaugeSet())
58-
registry.registerAll(new ThreadStatesGaugeSet())
56+
registry.register("jvm.attribute", new JvmAttributeGaugeSet())
57+
registry.register("jvm.gc", new GarbageCollectorMetricSet())
58+
registry.register("jvm.memory", new MemoryUsageGaugeSet())
59+
registry.register("jvm.threads", new ThreadStatesGaugeSet())
5960
}
6061
}
6162

‎src/test/scala/com/kenshoo/play/metrics/MetricsPluginTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MetricsPluginSpec extends Specification with Mockito with BeforeAfterExamp
5959
val plugin = config()
6060
plugin.onStart()
6161
val metrics: Map[String, Metric] = SharedMetricRegistries.getOrCreate("default").getMetrics
62-
metrics must haveKey("heap.usage")
62+
metrics must haveKey("jvm.memory.heap.usage")
6363
}
6464

6565
"registers logback metrics" in {

0 commit comments

Comments
 (0)
Please sign in to comment.