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 tikv_raftstore_event_duration to metrics; #3657

Merged
merged 1 commit into from Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/raftstore/store/fsm/store.rs
Expand Up @@ -1107,6 +1107,9 @@ impl<T: Transport, C: PdClient> mio::Handler for Store<T, C> {
Tick::CheckPeerStaleState => self.on_check_peer_stale_state_tick(event_loop),
Tick::CleanupImportSST => self.on_cleanup_import_sst_tick(event_loop),
}
RAFT_EVENT_DURATION
.with_label_values(&[timeout.tag()])
.observe(duration_to_sec(t.elapsed()) as f64);
slow_log!(t, "{} handle timeout {:?}", self.tag, timeout);
}

Expand Down
9 changes: 9 additions & 0 deletions src/raftstore/store/metrics.rs
Expand Up @@ -213,10 +213,19 @@ lazy_static! {
"Bucketed histogram of rocksdb ingestion durations",
exponential_buckets(0.005, 2.0, 20).unwrap()
).unwrap();

pub static ref RAFT_INVALID_PROPOSAL_COUNTER_VEC: IntCounterVec =
register_int_counter_vec!(
"tikv_raftstore_raft_invalid_proposal_total",
"Total number of raft invalid proposal.",
&["type"]
).unwrap();

pub static ref RAFT_EVENT_DURATION: HistogramVec =
register_histogram_vec!(
"tikv_raftstore_event_duration",
"Duration of raft store events.",
&["type"],
exponential_buckets(0.001, 1.59, 20).unwrap() // max 10s
).unwrap();
}
20 changes: 20 additions & 0 deletions src/raftstore/store/msg.rs
Expand Up @@ -124,6 +124,26 @@ pub enum Tick {
CleanupImportSST,
}

impl Tick {
#[inline]
pub fn tag(self) -> &'static str {
match self {
Tick::Raft => "raft",
Tick::RaftLogGc => "raft_log_gc",
Tick::SplitRegionCheck => "split_region_check",
Tick::CompactCheck => "compact_check",
Tick::PdHeartbeat => "pd_heartbeat",
Tick::PdStoreHeartbeat => "pd_store_heartbeat",
Tick::SnapGc => "snap_gc",
Tick::CompactLockCf => "compact_lock_cf",
Tick::ConsistencyCheck => "consistency_check",
Tick::CheckMerge => "check_merge",
Tick::CheckPeerStaleState => "check_peer_stale_state",
Tick::CleanupImportSST => "cleanup_import_sst",
}
}
}

#[derive(Debug, PartialEq)]
pub enum SignificantMsg {
SnapshotStatus {
Expand Down