prometheus-community / json_exporter

A prometheus exporter which scrapes remote JSON by JSONPath
Apache License 2.0
637 stars 197 forks source link

Missing target URL variable, string helpers and one metrics for each array items #83

Open jeremy-albinet opened 3 years ago

jeremy-albinet commented 3 years ago

Hello, I tried to parse the following JSON with json_exporter

{
  "status": "disconnected",
  "topics": [
    {
      "topic": "production",
      "count": 606037,
      "lag": 485172
    },
   {
      "topic": "production",
      "count": 23403,
      "lag": 2
    },
    {
      "topic": "staging",
      "count": 121,
      "lag": 0
    }
  ]
}

But I failed to:

Here the most advanced config I got:

metrics:
    - name: json_topics
      type: object
      path: "{ .topics[*] }"
      help: Topic info
      labels:
        topic: "{ .topic }"
      values:
        lag: "{ .lag }"
        count: "{ .count }"

Thanks in advance

kunkka234 commented 3 years ago

same problem here. really looking forward to this feature