Micrometer ElasticSearch 将 JSON 名称转换为密钥

Micrometer ElasticSearch convert JSON name to Key

我的应用程序中有一个千分尺 + spring 执行器,在 kibana 中以这种方式显示:

"name": "jvm_threads_daemon",
    "type": "gauge",
    "cluster": "cluster_app",
    "kubernetes_namespace": "test",
    "kubernetes_pod_name": "fargate-ip-10-121-31-148.ec2.internal",
    "value": 18

但我想转换成这样:

"jvm_threads_daemon": "18",
    "type": "gauge",
    "cluster": "cluster_app",
    "kubernetes_namespace": "test",
    "kubernetes_pod_name": "fargate-ip-10-121-31-148.ec2.internal",
    "value": 18

因此,请注意,我需要将指标作为标签名称,而不是在“名称”中。这在千分尺上是可能的吗?

看我的application.yml:

management:
  endpoints:
    web:
      exposure:
        include: "*"
      base-path: /actuator
      path-mapping.health: health
  endpoint:
    health:
      probes:
        enabled: true
      show-details: always
  metrics:
    export:
      elastic:
        host: "https://elastico.url:443"
        index: "metricbeat-k8s-apps"
        user-name: "elastic"
        password: "xxxx"
        step: 30s
        connect-timeout: 10s
    tags:
      cluster: "cluster_app"
      kubernetes.pod.name: ${NODE_NAME}
      kubernetes.namespace: ${POD_NAMESPACE}

您可以 extend/implement 自己的 ElasticMeterRegistry 并定义自己的 format

不过要考虑一件事:如果您进行了想要的更改,您将如何 query/filter/aggregate Kibana 中的指标?