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