diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-08-04 22:47:34 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-08-04 22:47:34 -0300 |
commit | e4495a6fd7113c2a163ea05c698c7058d45c7715 (patch) | |
tree | 17474bc695223f1c2df68060a6d3c6828ff5e56e /kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala | |
parent | 3fd7eaab868e3f108ee9e395577cc70053df7213 (diff) | |
download | Kamon-e4495a6fd7113c2a163ea05c698c7058d45c7715.tar.gz Kamon-e4495a6fd7113c2a163ea05c698c7058d45c7715.tar.bz2 Kamon-e4495a6fd7113c2a163ea05c698c7058d45c7715.zip |
+ datadog: subscribe and report user metrics
Diffstat (limited to 'kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala')
-rw-r--r-- | kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala b/kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala index 0f67cc34..3db3cbfb 100644 --- a/kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala +++ b/kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala @@ -22,6 +22,7 @@ import java.net.InetSocketAddress import akka.util.ByteString import kamon.metric.Subscriptions.TickMetricSnapshot import java.text.{ DecimalFormatSymbols, DecimalFormat } +import kamon.metric.UserMetrics.UserMetricGroup import kamon.metric.instrument.{ Counter, Histogram } import kamon.metric.{ MetricIdentity, MetricGroupIdentity } import java.util.Locale @@ -88,12 +89,22 @@ class DatadogMetricsSender(remote: InetSocketAddress, maxPacketSizeInBytes: Long def encodeStatsDCounter(count: Long): String = count.toString + "|c" def buildMetricName(groupIdentity: MetricGroupIdentity, metricIdentity: MetricIdentity): String = - s"$appName.${groupIdentity.category.name}.${metricIdentity.name}" + if(isUserMetric(groupIdentity)) + s"$appName.${groupIdentity.category.name}.${groupIdentity.name}" + else + s"$appName.${groupIdentity.category.name}.${metricIdentity.name}" def buildIdentificationTag(groupIdentity: MetricGroupIdentity, metricIdentity: MetricIdentity): String = { - // Make the automatic HTTP trace names a bit more friendly - val normalizedEntityName = groupIdentity.name.replace(": ", ":") - s"|#${groupIdentity.category.name}:${normalizedEntityName}" + if(isUserMetric(groupIdentity)) "" else { + // Make the automatic HTTP trace names a bit more friendly + val normalizedEntityName = groupIdentity.name.replace(": ", ":") + s"|#${groupIdentity.category.name}:${normalizedEntityName}" + } + } + + def isUserMetric(groupIdentity: MetricGroupIdentity): Boolean = groupIdentity match { + case someUserMetric: UserMetricGroup ⇒ true + case everythingElse ⇒ false } } |