Skip to main content

tracingChannel

function tracingChannel
unstable
Jump to headingtracingChannel<
StoreType = unknown,
ContextType extends object = StoreType extends object ? StoreType : object,
>
(nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>): TracingChannel<StoreType, ContextType>

Creates a TracingChannel wrapper for the given TracingChannel Channels. If a name is given, the corresponding tracing channels will be created in the form of tracing:${name}:${eventType} where eventType corresponds to the types of TracingChannel Channels.

import diagnostics_channel from 'node:diagnostics_channel';

const channelsByName = diagnostics_channel.tracingChannel('my-channel');

// or...

const channelsByCollection = diagnostics_channel.tracingChannel({
  start: diagnostics_channel.channel('tracing:my-channel:start'),
  end: diagnostics_channel.channel('tracing:my-channel:end'),
  asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
  asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
  error: diagnostics_channel.channel('tracing:my-channel:error'),
});

Type Parameters Jump to heading

Jump to headingStoreType = unknown
Jump to headingContextType extends object = StoreType extends object ? StoreType : object

Parameters Jump to heading

Channel name or object containing all the TracingChannel Channels

Return Type Jump to heading

Collection of channels to trace with

Back to top