Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter parameter causes HTTP Status 400 – Bad Request #957

Open
bob-tee opened this issue May 9, 2024 · 1 comment
Open

Filter parameter causes HTTP Status 400 – Bad Request #957

bob-tee opened this issue May 9, 2024 · 1 comment
Assignees

Comments

@bob-tee
Copy link

bob-tee commented May 9, 2024

I have a JEE application with the Prometheus servlet added to my web.xml file. The metrics work as expected except for when I pass the filter parameter to the /metrics endpoint. The [] characters cause a HTTP Status 400 error.

For example:

/metrics?name[]=jvm_threads_current
HTTP Status 400 – Bad Request
Type Exception Report

Message Invalid character found in the request target [/metrics?name[]=jvm_threads_current ]. The valid characters are defined in RFC 7230 and RFC 3986

Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

Apache Tomcat/10.1.15

I am following the documentation on this page:
https://prometheus.github.io/client_java/exporters/filter/

I can make it work if I URL Encode the [] characters. For example:

/metrics?name%5B%5D=jvm_threads_current

Perhaps there is no actual issue but the documentation could be updated to show the encoded version.

@dhoard
Copy link
Collaborator

dhoard commented May 9, 2024

@bob-tee great catch! This is a documentation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants