Skip to content

Unpredictable format of info metrics #2805

@antoxa9898

Description

@antoxa9898

What happened:
Hi. Our scraper which collects metric from KSM use such header - Accept: application/openmetrics-text;version=1.0.0;charset=utf-8,application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.7,text/plain;version=0.0.4;q=0.3
and it receives info metric in such format - # TYPE resource_info info

but if i make one request to ksm with such headers(like from browser) - Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7
it returns metric in such format - # TYPE resource_info gauge

and after this request our scraper receives this metric on all requests as - # TYPE resource_info gauge

What you expected to happen:
I expect that ksm should return metric in same format to all requests with specific headers

How to reproduce it (as minimally and precisely as possible):

curl -H 'Accept: application/openmetrics-text;version=1.0.0;charset=utf-8,application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.7,text/plain;version=0.0.4;q=0.3' http://ip-appress-here:8080/metrics | grep 'TYPE resource_info'
# TYPE resource_info info

curl -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' http://ip-appress-here:8080/metrics | grep 'TYPE resource_info'
# TYPE resource_info gauge

# now all requests with specific headers receive gauge, which previously received info
curl -H 'Accept: application/openmetrics-text;version=1.0.0;charset=utf-8,application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.7,text/plain;version=0.0.4;q=0.3' http://ip-appress-here:8080/metrics | grep 'TYPE resource_info'
# TYPE resource_info gauge

Anything else we need to know?:

Environment:

  • kube-state-metrics version: 2.17.0
  • Kubernetes version (use kubectl version): v1.31.8
  • Cloud provider or hardware configuration:
  • Other info:

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

Needs Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions