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

metrics: fix may count metrics multiple times #4654

Merged
merged 3 commits into from May 9, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1952,10 +1952,6 @@ impl<'a, T: Transport, C: PdClient> PeerFsmDelegate<'a, T, C> {
return None;
}

self.ctx.store_stat.lock_cf_bytes_written += metrics.lock_cf_written_bytes;
self.ctx.store_stat.engine_total_bytes_written += metrics.written_bytes;
self.ctx.store_stat.engine_total_keys_written += metrics.written_keys;

// handle executing committed log results
while let Some(result) = exec_results.pop_front() {
match result {
@@ -1994,6 +1990,13 @@ impl<'a, T: Transport, C: PdClient> PeerFsmDelegate<'a, T, C> {
ExecResult::IngestSST { ssts } => self.on_ingest_sst_result(ssts),
}
}

// Update metrics only when all exec_results are finished in case the metrics is counted multiple times

This comment has been minimized.

Copy link
@BusyJay

BusyJay May 8, 2019

Contributor

Can this be skipped if exec_results is empty?

This comment has been minimized.

Copy link
@Connor1996

Connor1996 May 8, 2019

Author Member

Yes, when exec_results is empty, on_ready_res would return directly at the beginning.

This comment has been minimized.

Copy link
@BusyJay

BusyJay May 8, 2019

Contributor

Is it expected?

This comment has been minimized.

Copy link
@Connor1996

Connor1996 May 8, 2019

Author Member

oh, I was thought when the exec_results is empty, the metrics are zeros. Fix it.

// when waiting for commit merge
self.ctx.store_stat.lock_cf_bytes_written += metrics.lock_cf_written_bytes;
self.ctx.store_stat.engine_total_bytes_written += metrics.written_bytes;
self.ctx.store_stat.engine_total_keys_written += metrics.written_keys;

None
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.