Crate scuffle_metrics

Source
Expand description

A wrapper around opentelemetry to provide a more ergonomic interface for creating metrics.

This crate can be used together with the scuffle-bootstrap-telemetry crate which provides a service that integrates with the scuffle-bootstrap ecosystem.

§Example

#[scuffle_metrics::metrics]
mod example {
    use scuffle_metrics::{MetricEnum, collector::CounterU64};

    #[derive(MetricEnum)]
    pub enum Kind {
        Http,
        Grpc,
    }

    #[metrics(unit = "requests")]
    pub fn request(kind: Kind) -> CounterU64;
}

// Increment the counter
example::request(example::Kind::Http).incr();

For details see metrics!.

§Status

This crate is currently under development and is not yet stable.

Unit tests are not yet fully implemented. Use at your own risk.

§License

This project is licensed under the MIT or Apache-2.0 license. You can choose between one of them if you use this work.

SPDX-License-Identifier: MIT OR Apache-2.0

Re-exports§

pub use collector::CounterF64;
pub use collector::CounterU64;
pub use collector::GaugeF64;
pub use collector::GaugeI64;
pub use collector::GaugeU64;
pub use collector::HistogramF64;
pub use collector::HistogramU64;
pub use collector::UpDownCounterF64;
pub use collector::UpDownCounterI64;
pub use opentelemetry;

Modules§

collector
Metrics collectors.
prometheusprometheus
A copy of the opentelemetry-prometheus crate, updated to work with the latest version of opentelemetry.

Attribute Macros§

metrics
A macro used to create metric handlers.

Derive Macros§

MetricEnum
Implements a conversion Into<opentelemetry::Value> for the enum. This allows the enum to be used as a metric label.