diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-03-20 15:52:00 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-03-20 15:52:00 +0100 |
commit | 1f4e5e64619a359880413cc6baf2182f5609753b (patch) | |
tree | b8d95993e87de5ffaab61489e6f89c2dc879687d /kamon-statsd/src | |
parent | 6a68dd54cf93592d7c3954895d255e4775b69f53 (diff) | |
download | Kamon-1f4e5e64619a359880413cc6baf2182f5609753b.tar.gz Kamon-1f4e5e64619a359880413cc6baf2182f5609753b.tar.bz2 Kamon-1f4e5e64619a359880413cc6baf2182f5609753b.zip |
! statsd: report segment metrics as sub-metrics of the correspondant trace.
Diffstat (limited to 'kamon-statsd/src')
-rw-r--r-- | kamon-statsd/src/main/scala/kamon/statsd/SimpleMetricKeyGenerator.scala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kamon-statsd/src/main/scala/kamon/statsd/SimpleMetricKeyGenerator.scala b/kamon-statsd/src/main/scala/kamon/statsd/SimpleMetricKeyGenerator.scala index fc72e837..97a27ff3 100644 --- a/kamon-statsd/src/main/scala/kamon/statsd/SimpleMetricKeyGenerator.scala +++ b/kamon-statsd/src/main/scala/kamon/statsd/SimpleMetricKeyGenerator.scala @@ -26,12 +26,16 @@ class SimpleMetricKeyGenerator(config: Config) extends MetricKeyGenerator { if (includeHostname) s"$application.$normalizedHostname" else application - def generateKey(entity: Entity, metricKey: MetricKey): String = { - val normalizedGroupName = normalizer(entity.name) - if (SingleInstrumentEntityRecorder.AllCategories.contains(entity.category)) - s"${baseName}.${entity.category}.${normalizedGroupName}" - else - s"${baseName}.${entity.category}.${normalizedGroupName}.${metricKey.name}" + def generateKey(entity: Entity, metricKey: MetricKey): String = entity.category match { + case "trace-segment" ⇒ + s"${baseName}.trace.${normalizer(entity.tags("trace"))}.segments.${normalizer(entity.name)}.${metricKey.name}" + + case _ if SingleInstrumentEntityRecorder.AllCategories.contains(entity.category) ⇒ + s"${baseName}.${entity.category}.${normalizer(entity.name)}" + + case _ ⇒ + s"${baseName}.${entity.category}.${normalizer(entity.name)}.${metricKey.name}" + } def hostName: String = ManagementFactory.getRuntimeMXBean.getName.split('@')(1) |