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

    EncodingError

    pub(all) suberror EncodingError {
    InvalidSnapshot(String)
    DuplicateLabelName(String)
    InvalidHistogram(String)
    } derive(Eq,
    Debug
    )

    A snapshot was not safe or self-consistent enough to expose.

    Exporting is deliberately all-or-nothing: callers receive this error before an EncodedExposition value is constructed, never a partially rendered metrics body.

    EncodedExposition

    pub(all) struct EncodedExposition {
    format : ExpositionFormat
    content_type : String
    body : String
    }

    A complete, immutable exposition payload.

    body always matches format and content_type; callers should forward the two fields together instead of constructing HTTP headers themselves.

    ExpositionFormat

    pub(all) enum ExpositionFormat {
    PrometheusText
    OpenMetricsText
    } derive(Eq,
    Debug
    )

    content_type

    fn content_type(format : ExpositionFormat) -> String

    encode

    Convenience OpenMetrics entry point for a complete registry snapshot.

    Unlike the scalar-only M0 compatibility function encode_registry, this gathers every registered collector, including vectors and custom adapters. New HTTP/exporter code should select an explicit format and use encode_snapshot(registry.gather(), format) so gather and encoding errors can be handled separately.

    encode_registry

    Transitional encoder for the M0 registry object.

    P0 callers should use encode_snapshot(registry.gather(), format) once Registry::gather is available. This compatibility path remains useful to existing M0 consumers and shares the same escaping, number, and format semantics.

    encode_snapshot

    Encode an immutable gather snapshot in the requested text exposition format.

    Family and sample order is canonicalized here, so equivalent snapshots produce identical bytes regardless of collection order. Prometheus text 0.0.4 omits UNIT and # EOF; OpenMetrics 1.0 includes both.

    is_openmetrics

    fn is_openmetrics(format : ExpositionFormat) -> Bool