Trace a synchronous function call. This will produce a start event and end event around the execution. This runs the given function using [channel.runStores(context, ...)][] on the start channel which ensures all events have any bound stores set to match this trace context.
import { boundedChannel } from 'node:diagnostics_channel';
const wc = boundedChannel('my-operation');
const result = wc.run({ operationId: '123' }, () => {
// Perform operation
return 42;
});