-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Inputs.prometheus] Error when parsing metrics from kube-state-metrics version v2.8.1 #12749
Comments
So this means that when it grabbed that URL it failed to parse it. Can you confirm that the URL provides valid data in the prometheus format to parse? |
Both kube-state-metrics versions have valid data, I attach one part of the output This is the response from kube-state-metrics version 2.7.0:
And this is from version 2.8.1:
|
That looks ok as well. Do you get the same with v2.8.0 as well? I'm wondering if kubernetes/kube-state-metrics#1974 is what is causing your issue. |
I change the image to version 2.8.0 and it's has the same error
According to this issue: kubernetes/kube-state-metrics#1974, It seem like we have problem when scrapt metric through http request instead of parsing metrics phase right? |
The reason I said during parsing is because the "error reading metrics for : ..." error happens right after we attempt to parse the metrics. If we had an issue making the HTTP request, the error is "error making HTTP request to", see here. The next error in the chain "reading metric family protocol buffer failed" comes from the prometheus v1 parser where it tries to read protobuf data. This is checked via the media type and params of the HTTP headers and seems to return true in your case. I assume you are using |
About your question about why I use
I tried to use urls config but it showed the same error:
|
I have put up #12779, which will print out some debug messages. I would like to see what the full response body and headers look like and see which protobuff message we are failing to parse. In 20-30mins from this message that PR will have artifacts attached. Can you download one of them, run with it, and provide the full output please? Thanks! I do still think this is related to the OpenMetrics being slightly different, in this case due to the protobuf not understanding it. Looking at the prometheus/client_model repo where we get the protobuf format from, there is an issue about updating the protobuf format for OpenMetrics. |
Thanks for your detailed explanation! |
I'm also using [email protected] and I experience exactly the same issue. |
Hi, Thanks for that output. Can either of you try setting the http header in your config, like: http_headers = {"Accept" = "text/plain"} It sounds like in kubernetes/kube-state-metrics#1974 that, that should revert to the old style metrics. Thanks! |
It seems like, telegraf version >= 1.25 is supported the custom HTTP header in inputs.prometheus (#12364)
|
Unfortunately, you cannot :) you would need to use the newer version with the feature. Any chance you could try this with the newer version somewhere? |
I do some customs with the Telegraf agent, so I must merge our customization to Telegraf version 1.25. |
Hello. I set this header in my telegraf config. Still have same error. My setup: Telegraf version:
Metrics:
|
I believe we now need to wait on this upstream issue: kubernetes/kube-state-metrics#2022 Even with setting the accept to text/plain, it is returning a content-type of:
Which will attempt to parse the data as protobuf data, when it is not. In summary:
Step to reproduce a K8s cluster with KSM: kind create cluster --name ksm
kind export kubeconfig --name=ksm
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install ksm prometheus-community/kube-state-metrics
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/instance=ksm" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 8080 I would prefer to close this as there is nothing in Telegraf for us to do currently. If the protobuf gets updated for OpenMetric support down the road, I would happily see an issue or even a PR to update the version of that dependency to support Openmetrics. Thanks! |
Let's pause the discussion here and await an update from kube-state-metrics! |
FYI: it's fixed in v2.8.2 |
I seem to be having the same issue with metrics from Authentik.
The
Headers in the request:
Tcpdump:
|
Thanks for your information. I think we can close this conversation now. |
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.23.0
Docker
No response
Steps to reproduce
...
Expected behavior
The input prometheus will scrape metrics normally but only when using kube-state-metrics image version 2.7.0
Actual behavior
Using kube-state-metrics image version 2.8.1, it has and error
[
inputs.prometheus] Error in plugin: error reading metrics for http://10.1.181.230:8080/metrics: reading metric family protocol buffer failed: proto: cannot parse invalid wire-format data``Additional info
No response
The text was updated successfully, but these errors were encountered: