Skip to content

Commit

Permalink
fix: use Duration seconds for future metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
xDarksome committed Jul 3, 2024
1 parent e384b25 commit 9365603
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions crates/metrics/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,8 @@ impl Drop for State {
}
}

self.metrics
.poll_duration
.record(duration_as_millis_f64(self.poll_duration_sum));

self.metrics
.poll_duration_max
.set(duration_as_millis_f64(self.poll_duration_max));

self.metrics.poll_duration.record(self.poll_duration_sum);
self.metrics.poll_duration_max.set(self.poll_duration_max);
self.metrics.polls.increment(self.polls_count as u64);
}
}
Expand All @@ -211,8 +205,3 @@ impl<F: Future> FusedFuture for Metered<F> {
self.state.is_finished
}
}

#[inline]
fn duration_as_millis_f64(val: Duration) -> f64 {
val.as_secs_f64() * 1000.0
}

0 comments on commit 9365603

Please sign in to comment.