Skip to content

Missing Content-Type in HttpResponse? #191

Description

@rkleinem

Hi,

the struct PrometheusMetricsHandler implements actix_web::Handler.
It constructs an HttpResponse here:

fn call(&self, _req: actix_web::HttpRequest) -> Self::Future {
Box::pin(future::ok(actix_web::HttpResponse::with_body(
StatusCode::OK,
self.metrics(),
)))
}

I think this header should have a Content-Type field as explained here: https://prometheus.io/docs/instrumenting/exposition_formats/.
(I.e. content-type: text/plain)
It seems that this became a real issue with Prometheus 3: prometheus/prometheus#15485.

I don't have a full overview of the ecosystem yet, so I hope this is the right place.
If you want I could make a PR for this.

Cheers

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions