Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mystenmark committed Nov 2, 2022
1 parent 1cfc38e commit 12ae866
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions crates/sui-metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ macro_rules! monitored_future {
}};

($metric: ident, $fut: expr) => {{
let name = format!("{}_{}", file!(), line!());
const LOCATION: &str = concat!(file!(), ':', line!());

async move {
let metrics = sui_metrics::get_metrics();

let _guard = if let Some(m) = &metrics {
m.$metric.with_label_values(&[&name]).inc();
m.$metric.with_label_values(&[LOCATION]).inc();
Some(sui_metrics::scopeguard::guard(m, |metrics| {
m.$metric.with_label_values(&[&name]).dec();
m.$metric.with_label_values(&[LOCATION]).dec();
}))
} else {
None
Expand Down

0 comments on commit 12ae866

Please sign in to comment.