Node.js module
diagnostics_channel
The 'node:diagnostics_channel' module provides a mechanism to create named channels to report arbitrary messages and data within an application. It enables instrumenting libraries and user code without introducing heavy dependencies.
Listeners can subscribe to channels to receive structured diagnostic events, making it useful for logging, tracing, and performance monitoring in production environments.
Fully supported in Bun
Fully implemented.
Functions 5
- diagnostics_channel.channel()
This is the primary entry-point for anyone wanting to publish to a named channel.
- diagnostics_channel.hasSubscribers()
Check if there are active subscribers to the named channel.
- diagnostics_channel.subscribe()
Register a message handler to subscribe to this channel.
- diagnostics_channel.tracingChannel()
Creates a
TracingChannelwrapper for the givenTracingChannel Channels. - diagnostics_channel.unsubscribe()
Remove a message handler previously registered to this channel with subscribe.
Classes 2
- class diagnostics_channel.Channel
The class
Channelrepresents an individual named channel within the data pipeline. - class diagnostics_channel.TracingChannel
The class
TracingChannelis a collection ofTracingChannel Channelswhich together express a single traceable action.