温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/diagnostics_channel/TracingChannel/tracePromise
点击访问原文链接

TracingChannel.tracePromise method | Node.js diagnostics_channel module | Bun

TracingChannel.tracePromise method | Node.js diagnostics_channel module | BunBuildDocsReferenceGuidesBlogDiscord/node:diagnostics_channel/TracingChannel/tracePromiseMtracePromise

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:diagnostics_channel/TracingChannel/tracePromiseMtracePromise

method

diagnostics_channel.TracingChannel.tracePromise { // Do something }, { some: 'thing', }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">tracePromiseThisArg = any, Args extends any[] = any[], Result = any>(fn: (this: ThisArg, ...args: Args) => PromiseResult>,context?: ContextType,thisArg?: ThisArg,...args: Args): PromiseResult>;Trace a promise-returning function call. This will always produce a start event and end event around the synchronous portion of the function execution, and will produce an asyncStart event and asyncEnd event when a promise continuation is reached. It may also produce an error event if the given function throws an error or the returned promise rejects. This will run the given function using channel.runStores(context, ...) on the start channel which ensures all events should have any bound stores set to match this trace context.

To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions which are added after the trace begins will not receive future events from that trace, only future traces will be seen.

import diagnostics_channel from 'node:diagnostics_channel'; const channels = diagnostics_channel.tracingChannel('my-channel'); channels.tracePromise(async () => { // Do something }, { some: 'thing', }); @param fnPromise-returning function to wrap a trace around

@param contextShared object to correlate trace events through

@param thisArgThe receiver to be used for the function call

@param argsOptional arguments to pass to the function

@returnsChained from promise returned by the given function

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录