mod openmetrics;
mod prometheus;
use std::io;
pub use super::profile::ProtobufProfile;
use crate::{error::Result, registry::Registry};
#[allow(missing_docs)]
#[allow(clippy::all)]
mod generated_data_model {
include!(concat!(env!("OUT_DIR"), "/protobuf/mod.rs"));
}
pub fn encode(
buffer: &mut dyn io::Write,
registry: &Registry,
profile: ProtobufProfile,
) -> Result<()> {
encode_with(buffer, registry, profile, crate::metrics::lazy_group::enter_scope)
}
pub fn encode_with<G>(
buffer: &mut dyn io::Write,
registry: &Registry,
profile: ProtobufProfile,
enter_scope: impl FnOnce() -> G,
) -> Result<()> {
let _guard = enter_scope();
match profile {
ProtobufProfile::OpenMetrics1 => openmetrics::encode(buffer, registry),
ProtobufProfile::Prometheus => prometheus::encode(buffer, registry),
}
}