Search code examples
javascalaakkastatsdakka-monitoring

Using Kamon how can I create a UserMetric with "." in the metric name?


I've managed to get the UserMetric extension working in my Java application to send my own stats to a statsd backend but at present the metric-name-normalization-strategy overrides my use of "." in the key names and replaces it with "_". I understand why it does this due to the integration with Akka but I don't want this to apply for my own UserMetrics where the "." is important for creating buckets of stats.

Is it possible to use an alternative metric-name-normalization-strategy for my user metrics rather than the one used for Akka metrics?

Thanks


Solution

  • You can provide the FQCN of your own implementation of kamon.statsd.MetricKeyGenerator in the configuration file [1]. Probably you might want to extend the default one [2] and add some special conditions for normalizing user metrics.

    [1] https://github.com/kamon-io/Kamon/blob/v0.3.5/kamon-statsd/src/main/resources/reference.conf#L35

    [2] https://github.com/kamon-io/Kamon/blob/v0.3.5/kamon-statsd/src/main/scala/kamon/statsd/SimpleMetricKeyGenerator.scala#L13

    See: https://groups.google.com/forum/#!topic/kamon-user/6Jt_vcKrrbI