Skip to content

Commit

Permalink
Add some write metrics (#2233)
Browse files Browse the repository at this point in the history
  • Loading branch information
huachaohuang committed Aug 30, 2017
1 parent 1994bb3 commit 1d5c244
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 40 additions & 5 deletions src/util/rocksdb/engine_metrics.rs
Expand Up @@ -63,6 +63,10 @@ pub const ENGINE_TICKER_TYPES: &'static [TickerType] = &[
TickerType::BloomFilterPrefixUseful,
TickerType::WalFileSynced,
TickerType::WalFileBytes,
TickerType::WriteDoneBySelf,
TickerType::WriteDoneByOther,
TickerType::WriteTimeout,
TickerType::WriteWithWAL,
TickerType::CompactReadBytes,
TickerType::CompactWriteBytes,
TickerType::FlushWriteBytes,
Expand Down Expand Up @@ -176,19 +180,19 @@ pub fn flush_engine_ticker_metrics(t: TickerType, value: u64, name: &str) {
.unwrap();
}
TickerType::GetHitL0 => {
STORE_ENGINE_READ_SURVED_VEC
STORE_ENGINE_GET_SERVED_VEC
.with_label_values(&[name, "get_hit_l0"])
.inc_by(value as f64)
.unwrap();
}
TickerType::GetHitL1 => {
STORE_ENGINE_READ_SURVED_VEC
STORE_ENGINE_GET_SERVED_VEC
.with_label_values(&[name, "get_hit_l1"])
.inc_by(value as f64)
.unwrap();
}
TickerType::GetHitL2AndUp => {
STORE_ENGINE_READ_SURVED_VEC
STORE_ENGINE_GET_SERVED_VEC
.with_label_values(&[name, "get_hit_l2_and_up"])
.inc_by(value as f64)
.unwrap();
Expand Down Expand Up @@ -337,6 +341,30 @@ pub fn flush_engine_ticker_metrics(t: TickerType, value: u64, name: &str) {
.inc_by(value as f64)
.unwrap();
}
TickerType::WriteDoneBySelf => {
STORE_ENGINE_WRITE_SERVED_VEC
.with_label_values(&[name, "write_done_by_self"])
.inc_by(value as f64)
.unwrap();
}
TickerType::WriteDoneByOther => {
STORE_ENGINE_WRITE_SERVED_VEC
.with_label_values(&[name, "write_done_by_other"])
.inc_by(value as f64)
.unwrap();
}
TickerType::WriteTimeout => {
STORE_ENGINE_WRITE_SERVED_VEC
.with_label_values(&[name, "write_timeout"])
.inc_by(value as f64)
.unwrap();
}
TickerType::WriteWithWAL => {
STORE_ENGINE_WRITE_SERVED_VEC
.with_label_values(&[name, "write_with_wal"])
.inc_by(value as f64)
.unwrap();
}
TickerType::CompactReadBytes => {
STORE_ENGINE_COMPACTION_FLOW_VEC
.with_label_values(&[name, "bytes_read"])
Expand Down Expand Up @@ -868,10 +896,17 @@ lazy_static!{
&["db", "type"]
).unwrap();

pub static ref STORE_ENGINE_READ_SURVED_VEC: CounterVec =
pub static ref STORE_ENGINE_GET_SERVED_VEC: CounterVec =
register_counter_vec!(
"tikv_engine_get_served",
"Get queries served by",
"Get queries served by engine",
&["db", "type"]
).unwrap();

pub static ref STORE_ENGINE_WRITE_SERVED_VEC: CounterVec =
register_counter_vec!(
"tikv_engine_write_served",
"Write queries served by engine",
&["db", "type"]
).unwrap();

Expand Down

0 comments on commit 1d5c244

Please sign in to comment.