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

[Bug]: strimzi operator doesn't expose content-type in /metrics endpoint #10902

Open
KyriosGN0 opened this issue Dec 3, 2024 · 7 comments · May be fixed by #10908
Open

[Bug]: strimzi operator doesn't expose content-type in /metrics endpoint #10902

KyriosGN0 opened this issue Dec 3, 2024 · 7 comments · May be fixed by #10908

Comments

@KyriosGN0
Copy link
Contributor

Bug Description

after upgrading to Prometheus v3, we noticed it started to alert us on TargetDown for strimzi operator pods
the error from the logs are non-compliant scrape target sending blank Content-Type and no fallback_scrape_protocol specified for target

Steps to reproduce

  1. deploy strimzi operator
  2. deploy prometheus v3
  3. create pod/service monitor and try to scrape the /metrics endpoint

Expected behavior

prometheus v3 should scrape without any issues

Strimzi version

0.44.0

Kubernetes version

1.30.5

Installation method

helm chart

Infrastructure

GKE

Configuration files and logs

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: cluster-operator-metrics
  labels:
    app: strimzi
spec:
  namespaceSelector:
    matchNames:
    - {{ .Release.Namespace }}
  podMetricsEndpoints:
  - path: /metrics
    port: http
  selector:
    matchLabels:
      name: strimzi-cluster-operator

podmonitor config we used

Additional context

No response

@scholzj
Copy link
Member

scholzj commented Dec 3, 2024

So, what is the correct content type?

@scholzj
Copy link
Member

scholzj commented Dec 3, 2024

The Prometheus JMX Exporter in the Kafka brokers uses Content-type: text/plain; version=0.0.4; charset=utf-8 -> so is text/plain ok for Prometheus 3?

@KyriosGN0
Copy link
Contributor Author

from what i see in curl
image
the endpoint doesn't return any
from the docs it says that the accept values are

# The protocols to negotiate during a scrape with the client.
# Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
# OpenMetricsText1.0.0, PrometheusText0.0.4, PrometheusText1.0.0.
[ scrape_protocols: [[<string>](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#string), ...] | default = <global_config.scrape_protocols> ]

@scholzj
Copy link
Member

scholzj commented Dec 3, 2024

the endpoint doesn't return any

Because that is the operator. It is different for the other components such as the Kafka pods.

from the docs it says that the accept values are

# The protocols to negotiate during a scrape with the client.
# Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
# OpenMetricsText1.0.0, PrometheusText0.0.4, PrometheusText1.0.0.
[ scrape_protocols: [[<string>](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#string), ...] | default = <global_config.scrape_protocols> ]

Not sure how the protocols translate to content types. But I guess we can assume text/plain is ok if Prometheus's own client uses it maybe?

Update: Seems to be mentioned here as well: https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info

@KyriosGN0
Copy link
Contributor Author

then yeah text/plain; version=0.0.4 should be good

scholzj added a commit to scholzj/strimzi-kafka-operator that referenced this issue Dec 3, 2024
@scholzj scholzj linked a pull request Dec 3, 2024 that will close this issue
3 tasks
@scholzj
Copy link
Member

scholzj commented Dec 3, 2024

Ok, I opened a PR for it. But I do not have any Prometheus 3 installation. So I cannot really test it with that. I only verified that my old Prometheus still works and that the Content-Type is there when trying with curl.

@KyriosGN0
Copy link
Contributor Author

@scholzj could i build the operator docker image from your PR and then run it with my prom v3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants