observeDurationSync<T> method
T
observeDurationSync<T>(
- T callback()
Observe the duration of callback
and store it in the corresponding
buckets of a histogram with labels.
Implementation
T observeDurationSync<T>(T Function() callback) {
final stopwatch = Stopwatch()..start();
try {
return callback();
} finally {
observe(stopwatch.elapsedMicroseconds / Duration.microsecondsPerSecond);
}
}