traceAsyncOperation<T> method
Called when an asynchronous operation
trace point is reached.
T
is the type of the result of the operation.
The method must call execute
exactly once. execute
might throw a
synchronous exception or return a Future that completes with an
exception. This method must return a Future that completes with the same
value as execute
or completes with the same exception as execute
.
Implementation
@override
Future<T> traceAsyncOperation<T>(
TracedOperation operation,
Future<T> Function() execute,
) async {
if (!_operationFilter(operation)) {
return execute();
}
final name = _operationNameResolver(operation);
final details = _operationDetailsResolver(operation);
final task = _provideTimelineTask();
try {
task?.start(name, arguments: details);
return await _withCblTimelineTask(task, execute);
} finally {
task?.finish();
}
}