method TracingChannel.prototype.traceSync
Unstable
Usage
import { TracingChannel } from "node:diagnostics_channel";
Trace a synchronous function call. This will always produce a start event and end event around the execution and may produce an error event if the given function throws an error.
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.
import diagnostics_channel from 'node:diagnostics_channel'; const channels = diagnostics_channel.tracingChannel('my-channel'); channels.traceSync(() => { // Do something }, { some: 'thing', });