Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/: Adopt serde style encoding #105

Merged
merged 1 commit into from Dec 10, 2022

Commits on Dec 2, 2022

  1. encoding/: Adopt serde style encoding

    Adopt encoding style similar to serde. `EncodeXXX` for a type that can be
    encoded (see serde's `Serialize`) and `XXXEncoder` for a supported encoding i.e.
    text and protobuf (see serde's `Serializer`).
    
    - Compatible with Rust's additive features. Enabling the `protobuf` feature does
    not change type signatures.
    - `EncodeMetric` is trait object safe, and thus `Registry` can use dynamic dispatch.
    - Implement a single encoding trait `EncodeMetric` per metric type instead of
    one implementation per metric AND per encoding format.
    - Leverage `std::fmt::Write` instead of `std::io::Write`. The OpenMetrics text
    format has to be unicode compliant. The OpenMetrics Protobuf format requires
    labels to be valid strings.
    
    Signed-off-by: Max Inden <mail@max-inden.de>
    mxinden committed Dec 2, 2022
    Copy the full SHA
    f0aa084 View commit details
    Browse the repository at this point in the history