elasticsearchkibanamicrometerspring-actuator

Micrometer ElasticSearch convert JSON name to Key


I have a micrometer + spring actuator in my application that shows in this way in 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

But I would like to convert to this:

"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

So, note that I need the metric as a tag name and not inside "name". This is possible in micrometer?

See my 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}

Solution

  • You can extend/implement your own ElasticMeterRegistry and define your own format.

    One thing to consider though: if you do the change you want, how will you able to query/filter/aggregate metrics in Kibana?