mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 19:32:55 +00:00
Add content-type header to metrics server response (#3970)
This fixes issues with certain metrics scrapers, which might error if the content-type is not correctly set. ## Issue Addressed Fixes https://github.com/sigp/lighthouse/issues/3437 ## Proposed Changes Simply set header: `Content-Type: text/plain` on metrics server response. Seems like the errored branch does this correctly already. ## Additional Info This is needed also to enable influx-db metric scraping which work very nicely with Geth.
This commit is contained in:
@@ -121,7 +121,13 @@ pub fn serve<T: EthSpec>(
|
||||
.and_then(|ctx: Arc<Context<T>>| async move {
|
||||
Ok::<_, warp::Rejection>(
|
||||
metrics::gather_prometheus_metrics(&ctx)
|
||||
.map(|body| Response::builder().status(200).body(body).unwrap())
|
||||
.map(|body| {
|
||||
Response::builder()
|
||||
.status(200)
|
||||
.header("Content-Type", "text/plain")
|
||||
.body(body)
|
||||
.unwrap()
|
||||
})
|
||||
.unwrap_or_else(|e| {
|
||||
Response::builder()
|
||||
.status(500)
|
||||
|
||||
Reference in New Issue
Block a user