mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Modularize tracing executor and metrics rename (#6424)
* Tracing executor and metrics rename * Appease clippy * Merge branch 'unstable' into modularise-task-executor
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
//! https://www.gnu.org/software/libc/manual/html_node/The-GNU-Allocator.html
|
||||
//!
|
||||
//! These functions are generally only suitable for Linux systems.
|
||||
use lighthouse_metrics::*;
|
||||
use metrics::*;
|
||||
use parking_lot::Mutex;
|
||||
use std::env;
|
||||
use std::os::raw::c_int;
|
||||
@@ -38,60 +38,57 @@ pub static GLOBAL_LOCK: LazyLock<Mutex<()>> = LazyLock::new(|| <_>::default());
|
||||
// Metrics for the malloc. For more information, see:
|
||||
//
|
||||
// https://man7.org/linux/man-pages/man3/mallinfo.3.html
|
||||
pub static MALLINFO_ARENA: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static MALLINFO_ARENA: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_arena",
|
||||
"The total amount of memory allocated by means other than mmap(2). \
|
||||
This figure includes both in-use blocks and blocks on the free list.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_ORDBLKS: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static MALLINFO_ORDBLKS: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_ordblks",
|
||||
"The number of ordinary (i.e., non-fastbin) free blocks.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_SMBLKS: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
pub static MALLINFO_SMBLKS: LazyLock<metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| try_create_int_gauge("mallinfo_smblks", "The number of fastbin free blocks."));
|
||||
pub static MALLINFO_HBLKS: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static MALLINFO_HBLKS: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_hblks",
|
||||
"The number of blocks currently allocated using mmap.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_HBLKHD: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static MALLINFO_HBLKHD: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_hblkhd",
|
||||
"The number of bytes in blocks currently allocated using mmap.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_FSMBLKS: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static MALLINFO_FSMBLKS: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_fsmblks",
|
||||
"The total number of bytes in fastbin free blocks.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_UORDBLKS: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_uordblks",
|
||||
"The total number of bytes used by in-use allocations.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_FORDBLKS: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_fordblks",
|
||||
"The total number of bytes in free blocks.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_KEEPCOST: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_keepcost",
|
||||
"The total amount of releasable free space at the top of the heap..",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_UORDBLKS: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_uordblks",
|
||||
"The total number of bytes used by in-use allocations.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_FORDBLKS: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_fordblks",
|
||||
"The total number of bytes in free blocks.",
|
||||
)
|
||||
});
|
||||
pub static MALLINFO_KEEPCOST: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge(
|
||||
"mallinfo_keepcost",
|
||||
"The total amount of releasable free space at the top of the heap..",
|
||||
)
|
||||
});
|
||||
|
||||
/// Calls `mallinfo` and updates Prometheus metrics with the results.
|
||||
pub fn scrape_mallinfo_metrics() {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//!
|
||||
//! A) `JEMALLOC_SYS_WITH_MALLOC_CONF` at compile-time.
|
||||
//! B) `_RJEM_MALLOC_CONF` at runtime.
|
||||
use lighthouse_metrics::{set_gauge, try_create_int_gauge, IntGauge};
|
||||
use metrics::{set_gauge, try_create_int_gauge, IntGauge};
|
||||
use std::sync::LazyLock;
|
||||
use tikv_jemalloc_ctl::{arenas, epoch, stats, Error};
|
||||
|
||||
@@ -15,22 +15,22 @@ use tikv_jemalloc_ctl::{arenas, epoch, stats, Error};
|
||||
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
||||
|
||||
// Metrics for jemalloc.
|
||||
pub static NUM_ARENAS: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
pub static NUM_ARENAS: LazyLock<metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| try_create_int_gauge("jemalloc_num_arenas", "The number of arenas in use"));
|
||||
pub static BYTES_ALLOCATED: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static BYTES_ALLOCATED: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge("jemalloc_bytes_allocated", "Equivalent to stats.allocated")
|
||||
});
|
||||
pub static BYTES_ACTIVE: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
pub static BYTES_ACTIVE: LazyLock<metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| try_create_int_gauge("jemalloc_bytes_active", "Equivalent to stats.active"));
|
||||
pub static BYTES_MAPPED: LazyLock<lighthouse_metrics::Result<IntGauge>> =
|
||||
pub static BYTES_MAPPED: LazyLock<metrics::Result<IntGauge>> =
|
||||
LazyLock::new(|| try_create_int_gauge("jemalloc_bytes_mapped", "Equivalent to stats.mapped"));
|
||||
pub static BYTES_METADATA: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static BYTES_METADATA: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge("jemalloc_bytes_metadata", "Equivalent to stats.metadata")
|
||||
});
|
||||
pub static BYTES_RESIDENT: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static BYTES_RESIDENT: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge("jemalloc_bytes_resident", "Equivalent to stats.resident")
|
||||
});
|
||||
pub static BYTES_RETAINED: LazyLock<lighthouse_metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
pub static BYTES_RETAINED: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
|
||||
try_create_int_gauge("jemalloc_bytes_retained", "Equivalent to stats.retained")
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user