asyncStart(event)


  • 名称:tracing:${name}:asyncStart

asyncStart 事件表示可追踪函数的回调或后续操作已被触发。在这一点上,回调参数或任何其他表示该操作“结果”的内容可能可用。

【The asyncStart event represents the callback or continuation of a traceable function being reached. At this point things like callback arguments may be available, or anything else expressing the "result" of the action.】

对于基于回调的函数,如果回调的第一个参数不是 undefinednull,它将被分配给 error 字段,而第二个参数将被分配给 result 字段。

【For callbacks-based functions, the first argument of the callback will be assigned to the error field, if not undefined or null, and the second argument will be assigned to the result field.】

对于 Promise,传给 resolve 路径的参数将被赋值给 result,或传给 reject 路径的参数将被赋值给 error

【For promises, the argument to the resolve path will be assigned to result or the argument to the reject path will be assign to error.】

建议专门监听 error 事件来跟踪错误,因为一个可追踪的操作可能会产生多个错误。例如,一个异步任务失败时,可能在任务的同步部分之前已在内部启动,然后抛出错误。

【It is recommended to listen specifically to the error event to track errors as it may be possible for a traceable action to produce multiple errors. For example, an async task which fails may be started internally before the sync part of the task then throws an error.】