-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
I've made the mistake a few times now of thinking a metric doesn't exist and finding it is in tokio::runtime::RuntimeMetrics rather than this crate.
Some examples of this are:
active_tasks_countnum_blocking_threadsnum_idle_blocking_threadsblocking_queue_depthio_driver_fd_registered_countio_driver_fd_deregistered_count
Is there a way to expose all of the available tokio metrics here and keep them in sync?
Currently we use tokio-metrics for most metrics and then manually get the missing ones from the runtime handle:
struct AdditionalTokioRuntimeMetrics {
active_tasks_count: usize,
num_blocking_threads: usize,
num_idle_blocking_threads: usize,
blocking_queue_depth: usize,
}
// NOTE: some metrics are not available from `tokio_metrics::RuntimeMetrics` so instead we
// get it from `tokio::runtime::RuntimeMetrics`
fn get_additional_tokio_metrics(
runtime: tokio::runtime::RuntimeMetrics,
) -> AdditionalTokioRuntimeMetrics {
AdditionalTokioRuntimeMetrics {
active_tasks_count: runtime.active_tasks_count(),
num_blocking_threads: runtime.num_blocking_threads(),
num_idle_blocking_threads: runtime.num_idle_blocking_threads(),
blocking_queue_depth: runtime.blocking_queue_depth(),
}
}Hoping to remove this snippet of code and rely exclusively on tokio-metrics.
Metadata
Metadata
Assignees
Labels
No labels