global_registry (src/lib.rs)

fuel-core · crates/metrics/src/lib.rs · rust · Apache-2.0
infra

Global metrics registry for FuelCore, exposing encode and registration functions.

#![deny(clippy::arithmetic_side_effects)]
// Source: https://github.com/FuelLabs/fuel-core | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
#![deny(clippy::cast_possible_truncation)]
#![deny(unused_crate_dependencies)]
#![deny(warnings)]

use prometheus_client::{
    encoding::text::encode,
    registry::Registry,
};
use std::{
    ops::Deref,
    sync::OnceLock,
};

/// The global register of all metrics.
#[derive(Default)]
pub struct GlobalRegistry {
    // It is okay to use std mutex because we register each metric only one time.
    pub registry: parking_lot::Mutex<Registry>,
}

mod buckets;
pub mod compression_metrics;
pub mod config;
pub mod core_metrics;
pub mod futures;
pub

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key