instrument method
Adds instrumentation to log calls and measure call time. It returns a InstrumentTiming object that is used to end the time measurement.
context
(optional) a context to trace execution through call chain.name
a method name. Returns InstrumentTiming object to end the time measurement.
Implementation
InstrumentTiming instrument(IContext? context, String name) {
logger.trace(context, "Executing %s method", [name]);
counters.incrementOne("$name.exec_count");
final counterTiming = counters.beginTiming("$name.exec_time");
final traceTiming = tracer.beginTrace(context, name, '');
return InstrumentTiming(
context, name, "exec", logger, counters, counterTiming, traceTiming);
}