Spring Actuator Metrics preserve "dot" in tags

384 Views Asked by At

I'm creating tags in my metrics exporter, in this way:

  metrics:
    export:
      elastic:
        host: "xx"
        index: "metricbeat-k8s-apps"
        user-name: "elastic"
        password: "xx"
        step: 30s
        connect-timeout: 10s
    tags:
      cluster: ${CLUSTER}
      kubernetes.pod.name: ${POD_NAME}
      kubernetes.namespace: ${POD_NAMESPACE}

But I don't know why "kubernetes.pod.name" is converted to "kubernetes_pod_name", how can I preserve the dots ?

1

There are 1 best solutions below

0
Jonatan Ivanov On BEST ANSWER

The word separator in Micrometer is 'dot' (see docs), according to the Elastic naming conventions, the word separator is 'underscore' in Elastic. In Micrometer, every registry has a NamingConvention. For Elastic, it is ElasticNamingConvention.

As you can see in that class, the default naming convention is snake_case:

public ElasticNamingConvention() {
    this(NamingConvention.snakeCase);
}

You can see how ElasticMeterRegistry uses this naming convention, but you can provide your own, please check the docs.