prometheus-community / json_exporter

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

Allow templatize in labels #265

Open bLd75 opened 12 months ago

bLd75 commented 12 months ago

Currently it's not possible to use variables in metrics labels, but some APIs return responses without the input. It would be great to be able to use variable values in metric labels.

Example

      labels:
        input_value: '{{ .myVal | first }}'

Error returned

caller=collector.go:134 level=error msg="Failed to parse jsonpath" err="unrecognized character in action: U+007B '{'" path="{{ .myVal | first }}"

Thanks in advance!

davordbetter commented 9 months ago

This would be very useful. Additionally, being able to templatize headers would be great too.