diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-08-04 23:54:58 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-08-04 23:54:58 -0300 |
commit | e2c6ad95350ab9e7cd1fba29a6f3279bd80db70c (patch) | |
tree | acbda15ce59eed76d792ba8bad5254759befbff2 /kamon-datadog/src/main/scala/kamon/datadog/DatadogMetricsSender.scala | |
parent | 8bdf10c22f05f1fe3033a2076fb839e36c966c4d (diff) | |
parent | 1256ed00ebb9496bfc67637526cf269acd4ea6fa (diff) | |
download | Kamon-e2c6ad95350ab9e7cd1fba29a6f3279bd80db70c.tar.gz Kamon-e2c6ad95350ab9e7cd1fba29a6f3279bd80db70c.tar.bz2 Kamon-e2c6ad95350ab9e7cd1fba29a6f3279bd80db70c.zip |
Merge branch 'master' into release-0.2
Conflicts:
version.sbt
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..5ab0589c 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 } } |