Commit 6ce3580
[SPARK-51770] Set
### 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
Closes apache#171 from jiangzho/monitoring.
Authored-by: Zhou JIANG <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>Content-Type headers for Prometheus v31 parent 25aa6cf commit 6ce3580
File tree
2 files changed
+29
-1
lines changed- spark-operator/src/main/java/org/apache/spark/k8s/operator
- metrics
- utils
2 files changed
+29
-1
lines changedspark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/PrometheusPullModelHandler.java
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
49 | 67 | | |
50 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
51 | 73 | | |
52 | 74 | | |
53 | 75 | | |
| |||
0 commit comments