Because Prometheus only supports text metrics and many tool return metrics in json (like Finatra, Spring Boot), I created a simple proxy which translates the json into text. Because I want to use it for multiple sources, the target from which the actual metrics are to be retrieved is set via a query param.
The metrics url looks like this:
/metrics?prefix=finatra&url=http://<ip>:9990/admin/metrics.json
This works fine in a browser or curl. However, in Prometheus the '?' gets encoded to '%3F' and therefore the request fails:
/metrics%3Fprefix=finatra&url=http://<ip>:9990/admin/metrics.json
How can I prevent Prometheus from encoding the ??
Is this a bug in Prometheus?
I already tried escaping with %
or \
, using unicode etc, but still no luck.
This behaviour is correct, as the metrics path is a path - not an arbitrary suffix on the protocol, host and port.
You're looking for the params configuration option:
scrape_configs:
- job_name: 'somename'
params:
prefix: ['finatra']
url: ['http://:9090/admin/metrics.json']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With