10 unstable releases (3 breaking)

Uses new Rust 2024

new 0.3.1 May 17, 2025
0.3.0 May 15, 2025
0.2.0 Apr 27, 2025
0.1.1 Feb 21, 2025
0.0.0 Nov 28, 2024

#463 in Debugging

Download history 1/week @ 2025-01-26 22/week @ 2025-02-02 159/week @ 2025-02-09 143/week @ 2025-02-16 38/week @ 2025-02-23 31/week @ 2025-03-02 12/week @ 2025-03-09 12/week @ 2025-03-16 4/week @ 2025-03-23 2/week @ 2025-03-30 4/week @ 2025-04-06 3/week @ 2025-04-13 129/week @ 2025-04-27 17/week @ 2025-05-04 148/week @ 2025-05-11

294 downloads per month
Used in scuffle-image-processor

MIT/Apache

92KB
2K SLoC

scuffle-metrics

[!WARNING]
This crate is under active development and may not be stable.

License: MIT OR Apache-2.0 docs.rs crates.io GitHub Actions: ci Codecov


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.

See the changelog for a full release history.

Feature flags

  • prometheus (enabled by default) — Enables prometheus support
  • tracing — Enables tracing support
  • docs — Enables changelog and documentation of feature flags

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!.

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

Dependencies

~2.8–9.5MB
~86K SLoC