guiqi695/moon-prometheus-sdk/http does not have a README file

    HttpMetricsError

    pub(all) suberror HttpMetricsError {
    MalformedAccept(String)
    AcceptHeaderTooLarge
    NotAcceptable
    } derive(Eq,
    Debug
    )

    Negotiation failures which can be mapped to a safe HTTP error response.
    pub(all) struct Header {
    name : String
    value : String
    }

    One response header emitted by the framework-neutral metrics adapter.

    MetricsResponse

    pub(all) struct MetricsResponse {
    status : Int
    headers : Array[Header]
    content_type : String
    body : String
    }

    A complete HTTP response ready for a framework-specific adapter to send.

    content_type remains as a convenience field for the M0 API. The same value is always present exactly once in headers as Content-Type.

    MetricsResponse::header

    fn MetricsResponse::header(self : MetricsResponse, name : String) -> String?

    Look up a response header case-insensitively for framework adapter tests.

    bad_request_response

    fn bad_request_response() -> MetricsResponse

    Return the stable response used for malformed or oversized Accept headers.

    internal_error_response

    fn internal_error_response() -> MetricsResponse

    Return the stable response used after gather or encoding fails.

    The body intentionally does not contain internal collector errors, label values, or a partial exposition.

    metrics_response

    Wrap a fully encoded exposition without depending on an HTTP framework.

    metrics_response_from_exposition

    Wrap an encoder result while preserving its format/content-type contract.

    negotiate

    Select a supported exposition format from an HTTP Accept header.

    Missing or blank Accept defaults to Prometheus text 0.0.4 for legacy scraper compatibility. For equal quality and equally specific explicit formats, OpenMetrics wins; a wildcard-only tie remains Prometheus.

    negotiated_metrics_response

    fn negotiated_metrics_response(accept : String?, prometheus_body : String, openmetrics_body : String) -> MetricsResponse

    Select one already-complete body for a framework-neutral metrics response.

    This is intentionally a pure function. A concrete server first calls negotiate, gathers and encodes exactly the selected format, then maps an encoder error to internal_error_response. Passing both bodies here keeps the content-negotiation contract directly testable without a web runtime.

    not_acceptable_response

    fn not_acceptable_response() -> MetricsResponse

    Return the stable response used when neither supported format is acceptable.