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

Unable to scrape Kube-State-Metrics 2.8.0 when using Native Histograms Feature #12121

Closed
Joseph-Irving opened this issue Mar 10, 2023 · 4 comments

Comments

@Joseph-Irving
Copy link

What did you do?

Upgraded Kube-State Metrics to 2.8.0, enabled native-histogram feature flag on Prometheus --enable-feature=native-histograms.

What did you expect to see?

Successful scraping of the kube-state-metrics endpoint

What did you see instead? Under which circumstances?

An error of proto: wrong wireType = 0 for field Metric when attempting to scrape the kube-state-metrics pod.
If native-histograms are disabled this error does not appear and it scrapes correctly as expected.

System information

No response

Prometheus version

2.42.0

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

@Joseph-Irving
Copy link
Author

I'm unsure whether this is a Kube-state-metrics issue or a Prometheus issue, but as it works when the experimental prometheus feature was disabled it made me think the issue lay within Prometheus. If that's not the case I can open an issue on the kube-state-metrics github instead. There was a change to the openmetrics format in this release kubernetes/kube-state-metrics#1974 which could be related? Seems others have seen this behaviour too prometheus-community/helm-charts#3050.

@Joseph-Irving
Copy link
Author

It seems enabling the Native Histograms turns on the Protobuf negotiation for each scrape.
https://github.com/prometheus/prometheus/blob/v2.42.0/cmd/prometheus/main.go#L199

c.scrape.EnableProtobufNegotiation = true

Which changes the accept header to the header with protobuf https://github.com/prometheus/prometheus/blob/v2.42.0/scrape/scrape.go#L440

if sp.enableProtobufNegotiation {
    acceptHeader = scrapeAcceptHeaderWithProtobuf
}

so that would explain why it only seems to be effected when native histograms are enabled.

@Joseph-Irving
Copy link
Author

FYI I've been looking into this on the KSM side and have opened an issue kubernetes/kube-state-metrics#2022

@Joseph-Irving
Copy link
Author

fixed in kube-state-metrics kubernetes/kube-state-metrics#2024

@prometheus prometheus locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

2 participants