-
Notifications
You must be signed in to change notification settings - Fork 902
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
When httpServerEnabled=true, Prometheus reports doesn't set content-type #2161
Comments
Good catch. |
yeah, I was just capturing this, don't have time at the moment but hope I get a minute to circle back soon |
hi, @shoothzj @fu-turer when i set httpServerEnabled=true, prometheus will not provide metrics, the code show as follows. And, if i modified the code that let prometheus provides metric endpoint while set httpServerEnabled=true, it will return content-Type with text/plain: is there any mistakes i make ? thanks. |
For your reference,I have to uncomment the line below in conf/bk_server.conf to make the /metrics api available. |
BUG REPORT
Describe the bug
When running with
httpServerEnabled
set to true,/metrics
endpoint stops sending acontent-type
header (this uses theMetricsService
, see code here https://github.com/apache/bookkeeper/blob/28dee8464764b0edceeb31ce24424f0947b5789b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/MetricsService.java).With the
httpServerEnabled=false
thePrometheusServlet
is used, and it does set a content-type header (bookkeeper/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/prometheus/PrometheusServlet.java
Line 44 in 28dee84
The content-type header is expected by some prometheus tools to differentiate between plaintext and protobuf formatted metrics and no content-type is considered an error.
To Reproduce
Steps to reproduce the behavior:
httpServerEnabled=false
and enable prometheus reportercurl localhost:8000/metrics
and notice that a content-type header is sethttpServerEnabled=true
and enable prometheus reportercurl localhost:8000/metrics -v
notice that there is no content-type header setExpected behavior
I expect a content-type header
It seems like the statsProvider interface should have a method for allowing to set headers on the response. Default to a given content type might cause problems with other providers.
The text was updated successfully, but these errors were encountered: