Skip to content

Conversation

@jiangzho
Copy link
Contributor

What changes were proposed in this pull request?

This PR sets Content-Type header for Prometheus handler to make it compatible with Prometheus v3

Why are the changes needed?

Prometheus v3 will fail the scrape if the Content-Type header is not present in response and the fallback scrape protocol is not configured. Therefore we'd configure the headers properly.

Please also refer https://prometheus.io/docs/prometheus/latest/migration/#scrape-protocols

Does this PR introduce any user-facing change?

No

How was this patch tested?

Tested via CI and local set up for Prometheus v3, via steps:

  • Deploy Prometheus v3 in k8s cluster, with default configuration (no fallback_scrape_protocol configured)
  • Deploy Spark Operator in cluster
  • Prometheus v3 is able to successfully scrape operator metrics

Was this patch authored or co-authored using generative AI tooling?

No

### What changes were proposed in this pull request?

This PR sets Content-Type header for Prometheus handler to make it compatible with Prometheus v3

### Why are the changes needed?

Prometheus v3 will fail the scrape if the Content-Type header is not present in response and the fallback scrape protocol is not configured. Therefore we'd configure the headers properly.

Please also refer https://prometheus.io/docs/prometheus/latest/migration/#scrape-protocols

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

Tested via CI and local set up for Prometheus v3, via steps:

* Deploy Prometheus v3 in k8s cluster, with default configuration (no fallback_scrape_protocol configured)
* Deploy Spark Operator in cluster
* Prometheus v3 is able to successfully scrape operator metrics

### Was this patch authored or co-authored using generative AI tooling?

No
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @jiangzho .

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-51770] Set Content-Type headers for Prometheus v3 compatibility [SPARK-51770] Set Content-Type headers for Prometheus v3 compatibility Apr 12, 2025
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-51770] Set Content-Type headers for Prometheus v3 compatibility [SPARK-51770] Set Content-Type headers for Prometheus v3 Apr 12, 2025
@dongjoon-hyun
Copy link
Member

Merged to main.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants