prometheus-community / json_exporter

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

Jsonpath in name: #147

Open scorpey opened 2 years ago

scorpey commented 2 years ago

Hi!

How can i use Jsonpath to generate name: ???

example:

path: '{ .components }'

i have same components and use labels: status: '{.status}'

if i have 10 components i must write to config 10 metrics.

But i whount use path to write name of metric

may be:

name: anycomponenname-'{ .components }'

and have generate metrics:

anycomponenname-name1 anycomponenname-name2 anycomponenname-name3 ...

help PLS

rustycl0ck commented 1 year ago

I don't understand your use case clearly, but it seems like you should use labels to differentiate between your metrics. Keep the metric name constant (because it is the information of same type/source) and attach labels for providing additional information.