diff options
Diffstat (limited to 'kamon-newrelic')
-rw-r--r-- | kamon-newrelic/src/main/scala/kamon/newrelic/CustomMetrics.scala | 5 | ||||
-rw-r--r-- | kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/CustomMetrics.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/CustomMetrics.scala index 44d9c605..a2b208dc 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/CustomMetrics.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/CustomMetrics.scala @@ -17,6 +17,7 @@ package kamon.newrelic import akka.actor.Actor +import kamon.metric.UserMetrics.UserMetricGroup import kamon.metric._ trait CustomMetrics { @@ -24,9 +25,9 @@ trait CustomMetrics { def collectCustomMetrics(metrics: Map[MetricGroupIdentity, MetricGroupSnapshot]): Seq[NewRelic.Metric] = { metrics.collect { - case (UserMetrics, groupSnapshot) ⇒ + case (mg: UserMetricGroup, groupSnapshot) ⇒ groupSnapshot.metrics collect { - case (name, snapshot) ⇒ toNewRelicMetric(Scale.Unit)(s"Custom/$name", None, snapshot) + case (name, snapshot) ⇒ toNewRelicMetric(Scale.Unit)(s"Custom/${mg.name}", None, snapshot) } }.flatten.toSeq } diff --git a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala index 01b32595..bdac5298 100644 --- a/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala +++ b/kamon-newrelic/src/main/scala/kamon/newrelic/NewRelic.scala @@ -16,6 +16,7 @@ package kamon.newrelic import akka.actor._ +import kamon.metric.UserMetrics.{ UserGauges, UserMinMaxCounters, UserCounters, UserHistograms } import scala.concurrent.duration._ import kamon.Kamon import kamon.metric.{ UserMetrics, TickMetricSnapshotBuffer, TraceMetrics, Metrics } @@ -30,7 +31,13 @@ class NewRelicExtension(system: ExtendedActorSystem) extends Kamon.Extension { val apdexT: Double = config.getMilliseconds("apdexT") / 1E3 // scale to seconds. Kamon(Metrics)(system).subscribe(TraceMetrics, "*", metricsListener, permanently = true) - Kamon(Metrics)(system).subscribe(UserMetrics.category, "*", metricsListener, permanently = true) + + // Subscribe to all user metrics + Kamon(Metrics)(system).subscribe(UserHistograms, "*", metricsListener, permanently = true) + Kamon(Metrics)(system).subscribe(UserCounters, "*", metricsListener, permanently = true) + Kamon(Metrics)(system).subscribe(UserMinMaxCounters, "*", metricsListener, permanently = true) + Kamon(Metrics)(system).subscribe(UserGauges, "*", metricsListener, permanently = true) + } class NewRelicMetricsListener extends Actor with ActorLogging { |