TracingChannel 通道
¥TracingChannel Channels
TracingChannel 是多个 diagnostics_channels 的集合,表示单个可跟踪操作的执行生命周期中的特定点。该行为分为五个 diagnostics_channels,包括 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.
当任务 "completes" 时,这些事件对象将使用 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:module.class.method:start
或tracing:module.function:start
¥
tracing:module.class.method:start
ortracing:module.function:start
-
tracing:module.class.method:end
或tracing:module.function:end
¥
tracing:module.class.method:end
ortracing:module.function:end
-
tracing:module.class.method:asyncStart
或tracing:module.function:asyncStart
¥
tracing:module.class.method:asyncStart
ortracing:module.function:asyncStart
-
tracing:module.class.method:asyncEnd
或tracing:module.function:asyncEnd
¥
tracing:module.class.method:asyncEnd
ortracing:module.function:asyncEnd
-
tracing:module.class.method:error
或tracing:module.function:error
¥
tracing:module.class.method:error
ortracing:module.function:error