moonbitstack/moonp8s/expo does not have a README file

    Format

    pub(all) enum Format {
    Text004
    OpenMetrics100
    }

    The exposition formats this library writes and reads.

    Format::content_type

    fn Format::content_type(self : Format) -> String

    The Content-Type an HTTP response should carry for this format.

    escape_help

    fn escape_help(v : String, quotes : Bool) -> String

    Escape help text. The compatibility format escapes backslash and newline; OpenMetrics also escapes the double quote, so help text survives a round trip inside a line-oriented document.

    escape_label_value

    fn escape_label_value(v : String) -> String

    Escape a label value: backslash, double quote, and newline are backslash-escaped, every other character passes through as UTF-8.

    format_float

    fn format_float(d : Double) -> String

    Format a float the way the official clients do: +Inf, -Inf, and NaN by name; otherwise the shortest decimal that round-trips, with a .0 on integers and Go's switch to a two-digit exponent once the integer part is longer than six digits (so 1000000.0 is 1e+06, matching what a Prometheus scrape expects to read).

    negotiate

    fn negotiate(accept : String) -> Format

    Pick a format from an HTTP Accept header. application/openmetrics-text wins when it names a version this library speaks (or names no version); otherwise a scrape gets the compatibility format, which is also the default when the header is absent or unrecognised.

    openmetrics

    fn openmetrics(families : Array[
    MetricFamily
    ]) -> String

    Write families in the OpenMetrics text format, version 1.0.0, ending with the # EOF marker the format requires.

    parse

    Parse an exposition back into families. The compatibility format is lossy for info and state sets, which it spells as gauges; OpenMetrics keeps them. The format argument selects which spelling conventions to expect, and the same parser accepts both because the syntax is a superset.

    text

    Write families in the Prometheus text exposition format, version 0.0.4. Counters gain a _total suffix, info becomes a gauge ending in _info, state sets become gauges, and _created, _gcount, and _gsum series are emitted as separate gauge families, as the compatibility format requires.