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] pulsar-recovery and pulsar-bookie components do not supply metrics in the standard Prometheus format. #555

Open
2 of 3 tasks
JWebDev opened this issue Dec 1, 2024 · 3 comments

Comments

@JWebDev
Copy link

JWebDev commented Dec 1, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

Version

apachepulsar/pulsar-all:4.0.0

Minimal reproduce step

Is this a bug or is it designed that way? Is there any solution for this? Because 2 other components send metrics in the correct format and prometheus reads them without problems. I don't use kube-prometheus-stack I add annotations to each component for my prometheus server to pick up the metrics.
For example:

autorecovery:
  replicaCount: 1
  podMonitor:
    enabled: false
  annotations:
    prometheus.io/scrape: “true”
    prometheus.io/path: “/metrics”
    prometheus.io/port: “8000”
broker:
  replicaCount: 1
  podMonitor:
    enabled: false
  annotations:
    prometheus.io/scrape: “true”
    prometheus.io/path: “/metrics”
    prometheus.io/port: “8080”

``/metrics` are visible in all components, so they are there.

What did you expect to see?

The same as in broker and zookeeper

pulsar-broker-0:/pulsar$ curl -I localhost:8080/metrics
HTTP/1.1 302 Found
Date: Sun, 01 Dec 2024 04:45:11 GMT
Location: http://localhost:8080/metrics/
Content-Length: 0
Server: Jetty(9.4.56.v20240826)

pulsar-zookeeper-0:/pulsar$ curl -I localhost:8000/metrics
HTTP/1.1 200 OK
Date: Sun, 01 Dec 2024 04:45:37 GMT
Content-Type: text/plain; version=0.0.4; charset=utf-8
Content-Length: 61427
Server: Jetty(9.4.56.v20240826)

What did you see instead?

pulsar-recovery-0:/pulsar$ curl -I localhost:8000/metrics
HTTP/1.1 405 Method Not Allowed

pulsar-bookie-0:/pulsar$ curl -I localhost:8000/metrics
HTTP/1.1 405 Method Not Allowed

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@lhotari
Copy link
Member

lhotari commented Dec 1, 2024

@JWebDev Do you use the Apache Pulsar Helm chart for deployment?

@JWebDev
Copy link
Author

JWebDev commented Dec 2, 2024

Hi @lhotari , yes. https://artifacthub.io/packages/helm/apache/pulsar

@lhotari lhotari transferred this issue from apache/pulsar Dec 2, 2024
@cizara
Copy link

cizara commented Dec 19, 2024

Hi, I'm experiencing the same behavior. Seems to be related to Prometheus v3 being rolled out in latest kube-prometheus-stack, as it has a breaking change to fail to scrape if Content-Type is not valid or missing, as stated in https://prometheus.io/docs/prometheus/3.0/migration/#scrape-protocols:

Prometheus v3 is more strict concerning the Content-Type header received when scraping. Prometheus v2 would default to the standard Prometheus text protocol if the target being scraped did not specify a Content-Type header or if the header was unparsable or unrecognised. This could lead to incorrect data being parsed in the scrape. Prometheus v3 will now fail the scrape in such cases.

The Content-Type seems to be missing:

pulsar-bookie-0:/pulsar$ curl -X GET -v -I http://127.0.0.1:8000/metrics
*   Trying 127.0.0.1:8000...
* Connected to 127.0.0.1 (127.0.0.1) port 8000
* using HTTP/1.x
> GET /metrics HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/8.11.0
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< content-length: 264341
content-length: 264341
< 

* shutting down connection #0

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

No branches or pull requests

3 participants