Params get encoded

Hi Prometheus Team
I want to know if i can prevent Prometheus from encoding the characters

  • job_name: ‘somename’
    prefix: [‘finatra’]
    url: [‘http://:9090/admin/metrics.json’]

When i do that,i get params encoded:

Is there any idea?

Hi LianYi,

The metrics path encoding can be avoided by using the metrics_path option in the job.

The HTTP resource path on which to fetch metrics from targets.

[ metrics_path: | default = /metrics ]



  • job_name: ‘somename’
    metrics_path: /admin/metrics.json
    scrape_interval: 20s
    • targets: [<target_ip_address>:80’]

I am not familiar with avoiding encoding of the general params. Good question.

Thanks a lot for your reply
just like your configurations:

  • job_name: ‘somename’
    metrics_path: /admin/metrics.json
    scrape_interval: 20s
    * targets: [‘’]

the url is

then i want to get some params, so i configure like this :

  • job_name: ‘somename’
    metrics_path: /admin/metrics.json?url=
    scrape_interval: 20s
    * targets: [‘’]

what i want is:
when i captured the packets from tcpdump,the url was encoded like this:

then i got an answer from stackoverflow:
like the issue,i can’t get the correct url what i want yet!

What is an example of a working URL? That should help convert to a Prometheus config.

the working url what i want is:
but i got:
just like a ‘Get’ mode http request,but some parameters got encoded
also some reserved characters in RFC3986,like “?” ,":","/"

The above might be closer but it looks like the “?” sign still gets encoded for the browser to handle it.


When the “endpoint” URL is clicked I see the URL as:

I found this relating to the question mark:

Also this is interesting:

Thanks a lot for your help
As a result,we can not write these to metrics_path
so need to use params configuration?

looks well at this time

But when I click the “Endpoint” URL,I get

of course, this is not what I want And will give rise to requesting false

Looks like Prometheus “URL Encodes” the metrics_path parameter URL by design.

This video says “do not encode the whole URL”.

My opinion is there should be an option to “Not URL encode” the metrics_path at all.

I guess we have to hope someone else provides some feedback.

What happens when you click on the Prometheus target link? Does the target show any logs?

I agree with you

When I click on the target link, I get 404 because of the error URL

So I test all the characters mentioned by RFC 3986:
metrics_path : :/?#[]@ !$&`()*+,;= -._~

And I get:


Maybe they are right And the working of decoding URL must do by the server

1 Like