Filter parameter causes HTTP Status 400 – Bad Request
bob-tee opened this issue · comments
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.
@bob-tee great catch! This is a documentation issue.