Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic metrics of multilevel task queue #27

Merged
merged 6 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ parking_lot_core = "0.7"
crossbeam-deque = "0.7"
dashmap = "1.2.0"
rand = "0.7"
prometheus = "0.7"
lazy_static = "1"

[dev-dependencies]
criterion = "0.3"
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

//! Yatp is a thread pool that tries to be adaptive, responsive and generic.

pub mod metrics;
pub mod pool;
pub mod queue;
pub mod task;
Expand Down
28 changes: 28 additions & 0 deletions src/metrics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.

//! Metrics of the thread pool.

use lazy_static::lazy_static;
use prometheus::*;

lazy_static! {
/// Elapsed time of each level in the multilevel task queue.
pub static ref MULTILEVEL_LEVEL_ELAPSED: IntCounterVec = IntCounterVec::new(
Opts::new(
"multilevel_level_elapsed",
"elapsed time of each level in the multilevel task queue"
),
&["name", "level"]
)
.unwrap();

/// The chance that a level 0 task is scheduled to run.
pub static ref MULTILEVEL_LEVEL0_CHANCE: GaugeVec = GaugeVec::new(
Opts::new(
"multilevel_level0_chance",
"the chance that a level 0 task is scheduled to run"
),
&["name"]
)
.unwrap();
}
Loading