【问题标题】:Spring Actuator Metrics preserve "dot" in tagsSpring Actuator Metrics 在标签中保留“点”
【发布时间】:2021-04-18 15:13:38
【问题描述】:

我正在以这种方式在我的指标导出器中创建标签:

  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}

但我不知道为什么“kubernetes.pod.name”被转换为“kubernetes_pod_name”,我怎样才能保留点?

【问题讨论】:

    标签: elasticsearch spring-boot-actuator micrometer spring-micrometer spring-actuator


    【解决方案1】:

    Micrometer 中的单词分隔符是“点”(see docs),根据Elastic naming conventions,Elastic 中的单词分隔符是“下划线”。在 Micrometer 中,每个注册表都有一个 NamingConvention。对于 Elastic,它是 ElasticNamingConvention

    您可以在该类中使用see,默认命名约定为snake_case

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

    您可以查看如何ElasticMeterRegistryuses this naming convention,但您可以提供自己的,请check the docs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-26
      • 2019-06-21
      • 2018-07-05
      • 2017-07-19
      • 1970-01-01
      • 2020-06-01
      • 1970-01-01
      • 2017-11-11
      相关资源
      最近更新 更多