TracingChannel 通道
【TracingChannel Channels】
TracingChannel 是多个 diagnostics_channel 的集合,表示单个可跟踪操作执行生命周期中的特定点。其行为分为五个 diagnostics_channel,包括 start、end、asyncStart、asyncEnd 和 error。单个可跟踪操作将在所有事件之间共享相同的事件对象,这对于通过 weakmap 管理关联非常有用。
【A TracingChannel is a collection of several diagnostics_channels representing
specific points in the execution lifecycle of a single traceable action. The
behaviour is split into five diagnostics_channels consisting of start,
end, asyncStart, asyncEnd, and error. A single traceable action will
share the same event object between all events, this can be helpful for
managing correlation through a weakmap.】
当任务“完成”时,这些事件对象将会扩展包含 result 或 error 的值。对于同步任务,result 将是返回值,而 error 则是函数中抛出的任何异常。对于基于回调的异步函数,result 将是回调的第二个参数,而 error 要么是在 end 事件中可见的抛出错误,要么是在 asyncStart 或 asyncEnd 事件中的第一个回调参数。
【These event objects will be extended with result or error values when
the task "completes". In the case of a synchronous task the result will be
the return value and the error will be anything thrown from the function.
With callback-based async functions the result will be the second argument
of the callback while the error will either be a thrown error visible in the
end event or the first callback argument in either of the asyncStart or
asyncEnd events.】
跟踪通道应遵循以下命名模式:
【Tracing channels should follow a naming pattern of:】
tracing:模块.类.方法:start或tracing:模块.函数:starttracing:模块.类.方法:end或tracing:模块.函数:endtracing:模块.类.方法:asyncStart或tracing:模块.函数:asyncStarttracing:模块.类.方法:asyncEnd或tracing:模块.函数:asyncEndtracing:模块.类.方法:错误或tracing:模块.函数:错误