{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"diagnostics_channel","path":"/diagnostics_channel","type":"module","module":"diagnostics_channel","title":"Diagnostics Channel","introducedIn":"v15.1.0","sourceLink":{"path":"lib/diagnostics_channel.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/diagnostics_channel.js"},"stability":{"index":"2","description":"Stable"},"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.2.0","v18.13.0"],"prUrl":"https://github.com/nodejs/node/pull/45290","commit":null,"description":"diagnostics_channel is now Stable."}],"description":"The `node:diagnostics_channel` module provides an API to create named channels\nto report arbitrary message data for diagnostics purposes.\n\nIt can be accessed using:\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n```\n\nIt is intended that a module writer wanting to report diagnostics messages\nwill create one or many top-level channels to report messages through.\nChannels may also be acquired at runtime but it is not encouraged\ndue to the additional overhead of doing so. Channels may be exported for\nconvenience, but as long as the name is known it can be acquired anywhere.\n\nIf you intend for your module to produce diagnostics data for others to\nconsume it is recommended that you include documentation of what named\nchannels are used along with the shape of the message data. Channel names\nshould generally include the module name to avoid collisions with data from\nother modules.","summary":"The `node:diagnostics_channel` module provides an API to create named channels to report arbitrary message data for diagnostics purposes.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');"}],"children":[{"kind":"section","id":"public-api","name":"Public API","title":"Public API","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"section","id":"overview","name":"Overview","title":"Overview","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Following is a simple overview of the public API.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\n// Get a reusable channel object\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\n// Subscribe to the channel\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\n// Check if the channel has an active subscriber\nif (channel.hasSubscribers) {\n  // Publish data to the channel\n  channel.publish({\n    some: 'data',\n  });\n}\n\n// Unsubscribe from the channel\ndiagnostics_channel.unsubscribe('my-channel', onMessage);\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\n// Get a reusable channel object\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\n// Subscribe to the channel\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\n// Check if the channel has an active subscriber\nif (channel.hasSubscribers) {\n  // Publish data to the channel\n  channel.publish({\n    some: 'data',\n  });\n}\n\n// Unsubscribe from the channel\ndiagnostics_channel.unsubscribe('my-channel', onMessage);\n```","summary":"Following is a simple overview of the public API.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\n// Get a reusable channel object\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\n// Subscribe to the channel\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\n// Check if the channel has an active subscriber\nif (channel.hasSubscribers) {\n  // Publish data to the channel\n  channel.publish({\n    some: 'data',\n  });\n}\n\n// Unsubscribe from the channel\ndiagnostics_channel.unsubscribe('my-channel', onMessage);"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\n// Get a reusable channel object\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\n// Subscribe to the channel\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\n// Check if the channel has an active subscriber\nif (channel.hasSubscribers) {\n  // Publish data to the channel\n  channel.publish({\n    some: 'data',\n  });\n}\n\n// Unsubscribe from the channel\ndiagnostics_channel.unsubscribe('my-channel', onMessage);"}],"children":[{"kind":"method","id":"diagnostics_channelhassubscribersname","name":"hasSubscribers","title":"`diagnostics_channel.hasSubscribers(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string | symbol","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":9,"end":15}]},"description":"The channel name","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If there are active subscribers"}},"description":"Check if there are active subscribers to the named channel. This is helpful if\nthe message you want to send might be expensive to prepare.\n\nThis API is optional but helpful when trying to publish messages from very\nperformance-sensitive code.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nif (diagnostics_channel.hasSubscribers('my-channel')) {\n  // There are subscribers, prepare and publish message\n}\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nif (diagnostics_channel.hasSubscribers('my-channel')) {\n  // There are subscribers, prepare and publish message\n}\n```","summary":"Check if there are active subscribers to the named channel. This is helpful if the message you want to send might be expensive to prepare.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nif (diagnostics_channel.hasSubscribers('my-channel')) {\n  // There are subscribers, prepare and publish message\n}"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nif (diagnostics_channel.hasSubscribers('my-channel')) {\n  // There are subscribers, prepare and publish message\n}"}],"children":[]},{"kind":"method","id":"diagnostics_channelchannelname","name":"channel","title":"`diagnostics_channel.channel(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string | symbol","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":9,"end":15}]},"description":"The channel name","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Channel","links":[{"name":"Channel","href":"diagnostics_channel.html#class-channel","start":0,"end":7}]},"description":"The named channel object"}},"description":"This is the primary entry-point for anyone wanting to publish to a named\nchannel. It produces a channel object which is optimized to reduce overhead at\npublish time as much as possible.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n```","summary":"This is the primary entry-point for anyone wanting to publish to a named channel. It produces a channel object which is optimized to reduce overhead at publish time as much as possible.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');"}],"children":[]},{"kind":"method","id":"diagnostics_channelsubscribename-onmessage","name":"subscribe","title":"`diagnostics_channel.subscribe(name, onMessage)`","scope":"module","overloadOf":null,"stability":null,"added":["v18.7.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string | symbol","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":9,"end":15}]},"description":"The channel name","default":null,"optional":false,"rest":false,"properties":[]},{"name":"onMessage","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The handler to receive channel messages","default":null,"optional":false,"rest":false,"properties":[{"name":"message","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The message data","default":null,"optional":false,"rest":false,"properties":[]},{"name":"name","type":{"text":"string | symbol","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":9,"end":15}]},"description":"The name of the channel","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Register a message handler to subscribe to this channel. This message handler\nwill be run synchronously whenever a message is published to the channel. Any\nerrors thrown in the message handler will trigger an [`'uncaughtException'`](process.html#event-uncaughtexception).\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\ndiagnostics_channel.subscribe('my-channel', (message, name) => {\n  // Received data\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\ndiagnostics_channel.subscribe('my-channel', (message, name) => {\n  // Received data\n});\n```","summary":"Register a message handler to subscribe to this channel. This message handler will be run synchronously whenever a message is published to the channel. Any errors thrown in the message handler will trigger an `'uncaughtException'`.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\ndiagnostics_channel.subscribe('my-channel', (message, name) => {\n  // Received data\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\ndiagnostics_channel.subscribe('my-channel', (message, name) => {\n  // Received data\n});"}],"children":[]},{"kind":"method","id":"diagnostics_channelunsubscribename-onmessage","name":"unsubscribe","title":"`diagnostics_channel.unsubscribe(name, onMessage)`","scope":"module","overloadOf":null,"stability":null,"added":["v18.7.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string | symbol","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":9,"end":15}]},"description":"The channel name","default":null,"optional":false,"rest":false,"properties":[]},{"name":"onMessage","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The previous subscribed handler to remove","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if the handler was found, `false` otherwise."}},"description":"Remove a message handler previously registered to this channel with\n[`diagnostics_channel.subscribe(name, onMessage)`](#diagnostics_channelsubscribename-onmessage).\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\ndiagnostics_channel.unsubscribe('my-channel', onMessage);\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\ndiagnostics_channel.unsubscribe('my-channel', onMessage);\n```","summary":"Remove a message handler previously registered to this channel with `diagnostics_channel.subscribe(name, onMessage)`.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\ndiagnostics_channel.unsubscribe('my-channel', onMessage);"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\ndiagnostics_channel.subscribe('my-channel', onMessage);\n\ndiagnostics_channel.unsubscribe('my-channel', onMessage);"}],"children":[]},{"kind":"method","id":"diagnostics_channeltracingchannelnameorchannels","name":"tracingChannel","title":"`diagnostics_channel.tracingChannel(nameOrChannels)`","scope":"module","overloadOf":null,"stability":{"index":"2","description":"Stable"},"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/64525","commit":null,"description":"Marked as stable."}],"signature":{"parameters":[{"name":"nameOrChannels","type":{"text":"string | TracingChannel","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"TracingChannel","href":"diagnostics_channel.html#class-tracingchannel","start":9,"end":23}]},"description":"Channel name or\nobject containing all the [TracingChannel Channels](#tracingchannel-channels)","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"TracingChannel","links":[{"name":"TracingChannel","href":"diagnostics_channel.html#class-tracingchannel","start":0,"end":14}]},"description":"Collection of channels to trace with"}},"description":"Creates a [`TracingChannel`](#class-tracingchannel) wrapper for the given\n[TracingChannel Channels](#tracingchannel-channels). If a name is given, the corresponding tracing\nchannels will be created in the form of `tracing:${name}:${eventType}` where\n`eventType` corresponds to the types of [TracingChannel Channels](#tracingchannel-channels).\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channelsByName = diagnostics_channel.tracingChannel('my-channel');\n\n// or...\n\nconst channelsByCollection = diagnostics_channel.tracingChannel({\n  start: diagnostics_channel.channel('tracing:my-channel:start'),\n  end: diagnostics_channel.channel('tracing:my-channel:end'),\n  asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),\n  asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),\n  error: diagnostics_channel.channel('tracing:my-channel:error'),\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channelsByName = diagnostics_channel.tracingChannel('my-channel');\n\n// or...\n\nconst channelsByCollection = diagnostics_channel.tracingChannel({\n  start: diagnostics_channel.channel('tracing:my-channel:start'),\n  end: diagnostics_channel.channel('tracing:my-channel:end'),\n  asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),\n  asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),\n  error: diagnostics_channel.channel('tracing:my-channel:error'),\n});\n```","summary":"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.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channelsByName = diagnostics_channel.tracingChannel('my-channel');\n\n// or...\n\nconst channelsByCollection = diagnostics_channel.tracingChannel({\n  start: diagnostics_channel.channel('tracing:my-channel:start'),\n  end: diagnostics_channel.channel('tracing:my-channel:end'),\n  asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),\n  asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),\n  error: diagnostics_channel.channel('tracing:my-channel:error'),\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channelsByName = diagnostics_channel.tracingChannel('my-channel');\n\n// or...\n\nconst channelsByCollection = diagnostics_channel.tracingChannel({\n  start: diagnostics_channel.channel('tracing:my-channel:start'),\n  end: diagnostics_channel.channel('tracing:my-channel:end'),\n  asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),\n  asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),\n  error: diagnostics_channel.channel('tracing:my-channel:error'),\n});"}],"children":[]},{"kind":"method","id":"diagnostics_channelboundedchannelnameorchannels","name":"boundedChannel","title":"`diagnostics_channel.boundedChannel(nameOrChannels)`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"nameOrChannels","type":{"text":"string | BoundedChannel","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"BoundedChannel","href":"diagnostics_channel.html#class-boundedchannel","start":9,"end":23}]},"description":"Channel name or\nobject containing all the [BoundedChannel Channels](#boundedchannel-channels)","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"BoundedChannel","links":[{"name":"BoundedChannel","href":"diagnostics_channel.html#class-boundedchannel","start":0,"end":14}]},"description":"Collection of channels to trace with"}},"description":"Creates a [`BoundedChannel`](#class-boundedchannel) wrapper for the given channels. If a name is\ngiven, the corresponding channels will be created in the form of\n`tracing:${name}:${eventType}` where `eventType` is `start` or `end`.\n\nA `BoundedChannel` is a simplified version of [`TracingChannel`](#class-tracingchannel) that only\ntraces synchronous operations. It only has `start` and `end` events, without\n`asyncStart`, `asyncEnd`, or `error` events, making it suitable for tracing\noperations that don't involve asynchronous continuations or error handling.\n\n```mjs\nimport { boundedChannel, channel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\n// or...\n\nconst wc2 = boundedChannel({\n  start: channel('tracing:my-operation:start'),\n  end: channel('tracing:my-operation:end'),\n});\n```\n\n```cjs\nconst { boundedChannel, channel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\n// or...\n\nconst wc2 = boundedChannel({\n  start: channel('tracing:my-operation:start'),\n  end: channel('tracing:my-operation:end'),\n});\n```","summary":"Creates a `BoundedChannel` wrapper for the given channels. If a name is given, the corresponding channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` is `start` or `end`.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel, channel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\n// or...\n\nconst wc2 = boundedChannel({\n  start: channel('tracing:my-operation:start'),\n  end: channel('tracing:my-operation:end'),\n});"},{"language":"cjs","displayName":null,"code":"const { boundedChannel, channel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\n// or...\n\nconst wc2 = boundedChannel({\n  start: channel('tracing:my-operation:start'),\n  end: channel('tracing:my-operation:end'),\n});"}],"children":[]}]},{"kind":"class","id":"class-channel","name":"Channel","title":"Class: `Channel`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The class `Channel` represents an individual named channel within the data\npipeline. It is used to track subscribers and to publish messages when there\nare subscribers present. It exists as a separate object to avoid channel\nlookups at publish time, enabling very fast publish speeds and allowing\nfor heavy use while incurring very minimal cost. Channels are created with\n[`diagnostics_channel.channel(name)`](#diagnostics_channelchannelname), constructing a channel directly\nwith `new Channel(name)` is not supported.","summary":"The class `Channel` represents an individual named channel within the data pipeline. It is used to track subscribers and to publish messages when there are subscribers present. It exists as a separate object to avoid channel lookups at publish time, enabling very fast publish speeds and allowing for heavy use while incurring very minimal cost. Channels are created with `diagnostics_channel.channel(name)`, constructing a channel directly with `new Channel(name)` is not supported.","examples":[],"children":[{"kind":"property","id":"channelhassubscribers","name":"hasSubscribers","title":"`channel.hasSubscribers`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"If there are active subscribers\n\nCheck if there are active subscribers to this channel. This is helpful if\nthe message you want to send might be expensive to prepare.\n\nThis API is optional but helpful when trying to publish messages from very\nperformance-sensitive code.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nif (channel.hasSubscribers) {\n  // There are subscribers, prepare and publish message\n}\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nif (channel.hasSubscribers) {\n  // There are subscribers, prepare and publish message\n}\n```","summary":"Check if there are active subscribers to this channel. This is helpful if the message you want to send might be expensive to prepare.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nif (channel.hasSubscribers) {\n  // There are subscribers, prepare and publish message\n}"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nif (channel.hasSubscribers) {\n  // There are subscribers, prepare and publish message\n}"}],"children":[]},{"kind":"method","id":"channelpublishmessage","name":"publish","title":"`channel.publish(message)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"message","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The message to send to the channel subscribers","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Publish a message to any subscribers to the channel. This will trigger\nmessage handlers synchronously so they will execute within the same context.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.publish({\n  some: 'message',\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.publish({\n  some: 'message',\n});\n```","summary":"Publish a message to any subscribers to the channel. This will trigger message handlers synchronously so they will execute within the same context.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.publish({\n  some: 'message',\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.publish({\n  some: 'message',\n});"}],"children":[]},{"kind":"method","id":"channelsubscribeonmessage","name":"subscribe","title":"`channel.subscribe(onMessage)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.8.0","v22.20.0"],"prUrl":"https://github.com/nodejs/node/pull/59758","commit":null,"description":"Deprecation revoked."},{"versions":["v18.7.0","v16.17.0"],"prUrl":"https://github.com/nodejs/node/pull/44943","commit":null,"description":"Documentation-only deprecation."}],"signature":{"parameters":[{"name":"onMessage","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The handler to receive channel messages","default":null,"optional":false,"rest":false,"properties":[{"name":"message","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The message data","default":null,"optional":false,"rest":false,"properties":[]},{"name":"name","type":{"text":"string | symbol","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":9,"end":15}]},"description":"The name of the channel","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Register a message handler to subscribe to this channel. This message handler\nwill be run synchronously whenever a message is published to the channel. Any\nerrors thrown in the message handler will trigger an [`'uncaughtException'`](process.html#event-uncaughtexception).\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.subscribe((message, name) => {\n  // Received data\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.subscribe((message, name) => {\n  // Received data\n});\n```","summary":"Register a message handler to subscribe to this channel. This message handler will be run synchronously whenever a message is published to the channel. Any errors thrown in the message handler will trigger an `'uncaughtException'`.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.subscribe((message, name) => {\n  // Received data\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.subscribe((message, name) => {\n  // Received data\n});"}],"children":[]},{"kind":"method","id":"channelunsubscribeonmessage","name":"unsubscribe","title":"`channel.unsubscribe(onMessage)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.8.0","v22.20.0"],"prUrl":"https://github.com/nodejs/node/pull/59758","commit":null,"description":"Deprecation revoked."},{"versions":["v18.7.0","v16.17.0"],"prUrl":"https://github.com/nodejs/node/pull/44943","commit":null,"description":"Documentation-only deprecation."},{"versions":["v17.1.0","v16.14.0","v14.19.0"],"prUrl":"https://github.com/nodejs/node/pull/40433","commit":null,"description":"Added return value. Added to channels without subscribers."}],"signature":{"parameters":[{"name":"onMessage","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The previous subscribed handler to remove","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if the handler was found, `false` otherwise."}},"description":"Remove a message handler previously registered to this channel with\n[`channel.subscribe(onMessage)`](#channelsubscribeonmessage).\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\nchannel.subscribe(onMessage);\n\nchannel.unsubscribe(onMessage);\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\nchannel.subscribe(onMessage);\n\nchannel.unsubscribe(onMessage);\n```","summary":"Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\nchannel.subscribe(onMessage);\n\nchannel.unsubscribe(onMessage);"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nfunction onMessage(message, name) {\n  // Received data\n}\n\nchannel.subscribe(onMessage);\n\nchannel.unsubscribe(onMessage);"}],"children":[]},{"kind":"method","id":"channelbindstorestore-transform","name":"bindStore","title":"`channel.bindStore(store[, transform])`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"store","type":{"text":"AsyncLocalStorage","links":[{"name":"AsyncLocalStorage","href":"async_context.html#class-asynclocalstorage","start":0,"end":17}]},"description":"The store to which to bind the context data","default":null,"optional":false,"rest":false,"properties":[]},{"name":"transform","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"Transform context data before setting the store context","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"When [`channel.runStores(context, ...)`](#channelrunstorescontext-fn-thisarg-args) is called, the given context data\nwill be applied to any store bound to the channel. If the store has already been\nbound the previous `transform` function will be replaced with the new one.\nThe `transform` function may be omitted to set the given context data as the\ncontext directly.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (data) => {\n  return { data };\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (data) => {\n  return { data };\n});\n```","summary":"When `channel.runStores(context, ...)` is called, the given context data will be applied to any store bound to the channel. If the store has already been bound the previous `transform` function will be replaced with the new one. The `transform` function may be omitted to set the given context data as the context directly.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (data) => {\n  return { data };\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (data) => {\n  return { data };\n});"}],"children":[]},{"kind":"method","id":"channelunbindstorestore","name":"unbindStore","title":"`channel.unbindStore(store)`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"store","type":{"text":"AsyncLocalStorage","links":[{"name":"AsyncLocalStorage","href":"async_context.html#class-asynclocalstorage","start":0,"end":17}]},"description":"The store to unbind from the channel.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if the store was found, `false` otherwise."}},"description":"Remove a message handler previously registered to this channel with\n[`channel.bindStore(store)`](#channelbindstorestore-transform).\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store);\nchannel.unbindStore(store);\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store);\nchannel.unbindStore(store);\n```","summary":"Remove a message handler previously registered to this channel with `channel.bindStore(store)`.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store);\nchannel.unbindStore(store);"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store);\nchannel.unbindStore(store);"}],"children":[]},{"kind":"method","id":"channelrunstorescontext-fn-thisarg-args","name":"runStores","title":"`channel.runStores(context, fn[, thisArg[, ...args]])`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"context","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Message to send to subscribers and bind to stores","default":null,"optional":false,"rest":false,"properties":[]},{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"Handler to run within the entered storage context","default":null,"optional":false,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The receiver to be used for the function call.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"args","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Optional arguments to pass to the function.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":null},"description":"Applies the given data to any AsyncLocalStorage instances bound to the channel\nfor the duration of the given function, then publishes to the channel within\nthe scope of that data is applied to the stores.\n\nIf a transform function was given to [`channel.bindStore(store)`](#channelbindstorestore-transform) it will be\napplied to transform the message data before it becomes the context value for\nthe store. The prior storage context is accessible from within the transform\nfunction in cases where context linking is required.\n\nThe context applied to the store should be accessible in any async code which\ncontinues from execution which began during the given function, however\nthere are some situations in which [context loss](async_context.html#troubleshooting-context-loss) may occur.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (message) => {\n  const parent = store.getStore();\n  return new Span(message, parent);\n});\nchannel.runStores({ some: 'message' }, () => {\n  store.getStore(); // Span({ some: 'message' })\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (message) => {\n  const parent = store.getStore();\n  return new Span(message, parent);\n});\nchannel.runStores({ some: 'message' }, () => {\n  store.getStore(); // Span({ some: 'message' })\n});\n```","summary":"Applies the given data to any AsyncLocalStorage instances bound to the channel for the duration of the given function, then publishes to the channel within the scope of that data is applied to the stores.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (message) => {\n  const parent = store.getStore();\n  return new Span(message, parent);\n});\nchannel.runStores({ some: 'message' }, () => {\n  store.getStore(); // Span({ some: 'message' })\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\n\nconst channel = diagnostics_channel.channel('my-channel');\n\nchannel.bindStore(store, (message) => {\n  const parent = store.getStore();\n  return new Span(message, parent);\n});\nchannel.runStores({ some: 'message' }, () => {\n  store.getStore(); // Span({ some: 'message' })\n});"}],"children":[]},{"kind":"method","id":"channelwithstorescopedata","name":"withStoreScope","title":"`channel.withStoreScope(data)`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"data","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Message to bind to stores","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"RunStoresScope","links":[{"name":"RunStoresScope","href":"diagnostics_channel.html#class-runstoresscope","start":0,"end":14}]},"description":"Disposable scope object"}},"description":"Creates a disposable scope that binds the given data to any AsyncLocalStorage\ninstances bound to the channel and publishes it to subscribers. The scope\nautomatically restores the previous storage contexts when disposed.\n\nThis method enables the use of JavaScript's explicit resource management\n(`using` syntax with `Symbol.dispose`) to manage store contexts without\nclosure wrapping.\n\n```mjs\nimport { channel } from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\nconst ch = channel('my-channel');\n\nch.bindStore(store, (message) => {\n  return { ...message, timestamp: Date.now() };\n});\n\n{\n  using scope = ch.withStoreScope({ request: 'data' });\n  // Store is entered, data is published\n  console.log(store.getStore()); // { request: 'data', timestamp: ... }\n}\n// Store is automatically restored on scope exit\n```\n\n```cjs\nconst { channel } = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\nconst ch = channel('my-channel');\n\nch.bindStore(store, (message) => {\n  return { ...message, timestamp: Date.now() };\n});\n\n{\n  using scope = ch.withStoreScope({ request: 'data' });\n  // Store is entered, data is published\n  console.log(store.getStore()); // { request: 'data', timestamp: ... }\n}\n// Store is automatically restored on scope exit\n```","summary":"Creates a disposable scope that binds the given data to any AsyncLocalStorage instances bound to the channel and publishes it to subscribers. The scope automatically restores the previous storage contexts when disposed.","examples":[{"language":"mjs","displayName":null,"code":"import { channel } from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst store = new AsyncLocalStorage();\nconst ch = channel('my-channel');\n\nch.bindStore(store, (message) => {\n  return { ...message, timestamp: Date.now() };\n});\n\n{\n  using scope = ch.withStoreScope({ request: 'data' });\n  // Store is entered, data is published\n  console.log(store.getStore()); // { request: 'data', timestamp: ... }\n}\n// Store is automatically restored on scope exit"},{"language":"cjs","displayName":null,"code":"const { channel } = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst store = new AsyncLocalStorage();\nconst ch = channel('my-channel');\n\nch.bindStore(store, (message) => {\n  return { ...message, timestamp: Date.now() };\n});\n\n{\n  using scope = ch.withStoreScope({ request: 'data' });\n  // Store is entered, data is published\n  console.log(store.getStore()); // { request: 'data', timestamp: ... }\n}\n// Store is automatically restored on scope exit"}],"children":[]}]},{"kind":"class","id":"class-runstoresscope","name":"RunStoresScope","title":"Class: `RunStoresScope`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The class `RunStoresScope` represents a disposable scope created by\n[`channel.withStoreScope(data)`](#channelwithstorescopedata). It manages the lifecycle of store\ncontexts and ensures they are properly restored when the scope exits.\n\nThe scope must be used with the `using` syntax to ensure proper disposal.","summary":"The class `RunStoresScope` represents a disposable scope created by `channel.withStoreScope(data)`. It manages the lifecycle of store contexts and ensures they are properly restored when the scope exits.","examples":[],"children":[]},{"kind":"class","id":"class-tracingchannel","name":"TracingChannel","title":"Class: `TracingChannel`","scope":"module","overloadOf":null,"stability":{"index":"2","description":"Stable"},"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/64525","commit":null,"description":"Marked as stable."}],"extends":null,"description":"The class `TracingChannel` is a collection of [TracingChannel Channels](#tracingchannel-channels) which\ntogether express a single traceable action. It is used to formalize and\nsimplify the process of producing events for tracing application flow.\n[`diagnostics_channel.tracingChannel()`](#diagnostics_channeltracingchannelnameorchannels) is used to construct a\n`TracingChannel`. As with `Channel` it is recommended to create and reuse a\nsingle `TracingChannel` at the top-level of the file rather than creating them\ndynamically.","summary":"The class `TracingChannel` is a collection of TracingChannel Channels which together express a single traceable action. It is used to formalize and simplify the process of producing events for tracing application flow. `diagnostics_channel.tracingChannel()` is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a single `TracingChannel` at the top-level of the file rather than creating them dynamically.","examples":[],"children":[{"kind":"method","id":"tracingchannelsubscribesubscribers","name":"subscribe","title":"`tracingChannel.subscribe(subscribers)`","scope":"module","overloadOf":null,"stability":null,"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"subscribers","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Set of [TracingChannel Channels](#tracingchannel-channels) subscribers","default":null,"optional":false,"rest":false,"properties":[{"name":"start","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`start` event](#startevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"end","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`end` event](#endevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"asyncStart","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`asyncStart` event](#asyncstartevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"asyncEnd","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`asyncEnd` event](#asyncendevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`error` event](#errorevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Helper to subscribe a collection of functions to the corresponding channels.\nThis is the same as calling [`channel.subscribe(onMessage)`](#channelsubscribeonmessage) on each channel\nindividually.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.subscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.subscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});\n```","summary":"Helper to subscribe a collection of functions to the corresponding channels. This is the same as calling `channel.subscribe(onMessage)` on each channel individually.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.subscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.subscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});"}],"children":[]},{"kind":"method","id":"tracingchannelunsubscribesubscribers","name":"unsubscribe","title":"`tracingChannel.unsubscribe(subscribers)`","scope":"module","overloadOf":null,"stability":null,"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"subscribers","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Set of [TracingChannel Channels](#tracingchannel-channels) subscribers","default":null,"optional":false,"rest":false,"properties":[{"name":"start","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`start` event](#startevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"end","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`end` event](#endevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"asyncStart","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`asyncStart` event](#asyncstartevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"asyncEnd","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`asyncEnd` event](#asyncendevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The [`error` event](#errorevent) subscriber","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if all handlers were successfully unsubscribed,\nand `false` otherwise."}},"description":"Helper to unsubscribe a collection of functions from the corresponding channels.\nThis is the same as calling [`channel.unsubscribe(onMessage)`](#channelunsubscribeonmessage) on each channel\nindividually.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.unsubscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.unsubscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});\n```","summary":"Helper to unsubscribe a collection of functions from the corresponding channels. This is the same as calling `channel.unsubscribe(onMessage)` on each channel individually.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.unsubscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.unsubscribe({\n  start(message) {\n    // Handle start message\n  },\n  end(message) {\n    // Handle end message\n  },\n  asyncStart(message) {\n    // Handle asyncStart message\n  },\n  asyncEnd(message) {\n    // Handle asyncEnd message\n  },\n  error(message) {\n    // Handle error message\n  },\n});"}],"children":[]},{"kind":"method","id":"tracingchanneltracesyncfn-context-thisarg-args","name":"traceSync","title":"`tracingChannel.traceSync(fn[, context[, thisArg[, ...args]]])`","scope":"module","overloadOf":null,"stability":null,"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"Function to wrap a trace around","default":null,"optional":false,"rest":false,"properties":[]},{"name":"context","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Shared object to correlate events through","default":null,"optional":true,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The receiver to be used for the function call","default":null,"optional":true,"rest":false,"properties":[]},{"name":"args","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Optional arguments to pass to the function","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The return value of the given function"}},"description":"Trace a synchronous function call. This will always produce a [`start` event](#startevent)\nand [`end` event](#endevent) around the execution and may produce an [`error` event](#errorevent)\nif the given function throws an error. This will run the given function using\n[`channel.runStores(context, ...)`](#channelrunstorescontext-fn-thisarg-args) on the `start` channel which ensures all\nevents should have any bound stores set to match this trace context.\n\nTo ensure only correct trace graphs are formed, events will only be published\nif subscribers are present prior to starting the trace. Subscriptions which are\nadded after the trace begins will not receive future events from that trace,\nonly future traces will be seen.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceSync(() => {\n  // Do something\n}, {\n  some: 'thing',\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceSync(() => {\n  // Do something\n}, {\n  some: 'thing',\n});\n```","summary":"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.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceSync(() => {\n  // Do something\n}, {\n  some: 'thing',\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceSync(() => {\n  // Do something\n}, {\n  some: 'thing',\n});"}],"children":[]},{"kind":"method","id":"tracingchanneltracepromisefn-context-thisarg-args","name":"tracePromise","title":"`tracingChannel.tracePromise(fn[, context[, thisArg[, ...args]]])`","scope":"module","overloadOf":null,"stability":null,"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.5.0"],"prUrl":"https://github.com/nodejs/node/pull/62407","commit":null,"description":"Non-native-Promise thenables are now returned as-is, preserving their original type and methods."},{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/61766","commit":null,"description":"Non-thenables will be returned with a warning."}],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"Function to wrap a trace around","default":null,"optional":false,"rest":false,"properties":[]},{"name":"context","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Shared object to correlate trace events through","default":null,"optional":true,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The receiver to be used for the function call","default":null,"optional":true,"rest":false,"properties":[]},{"name":"args","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Optional arguments to pass to the function","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The return value of the given function. If the return value\nis a Promise or thenable, tracing events will be published when it settles.\nIf the return value is not a Promise or thenable, it is returned as-is and\na warning is emitted."}},"description":"Trace an asynchronous function call which returns a {Promise} or\n[thenable object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables). This will always produce a [`start` event](#startevent) and\n[`end` event](#endevent) around the synchronous portion of the function execution, and\nwill produce an [`asyncStart` event](#asyncstartevent) and [`asyncEnd` event](#asyncendevent) when the\nreturned promise is resolved or rejected. It may also produce an\n[`error` event](#errorevent) if the given function throws an error or the returned promise\nis rejected. This will run the given function using\n[`channel.runStores(context, ...)`](#channelrunstorescontext-fn-thisarg-args) on the `start` channel which ensures all\nevents should have any bound stores set to match this trace context.\n\nIf the value returned by `fn` is not a Promise or thenable, then it will be\nreturned with a warning, and no `asyncStart` or `asyncEnd` events will be\nproduced.\n\nTo ensure only correct trace graphs are formed, events will only be published\nif subscribers are present prior to starting the trace. Subscriptions which are\nadded after the trace begins will not receive future events from that trace,\nonly future traces will be seen.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.tracePromise(async () => {\n  // Do something\n}, {\n  some: 'thing',\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.tracePromise(async () => {\n  // Do something\n}, {\n  some: 'thing',\n});\n```","summary":"Trace an asynchronous function call which returns a {Promise} or thenable object. 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 the returned promise is resolved or rejected. It may also produce an `error` event if the given function throws an error or the returned promise is rejected. 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.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.tracePromise(async () => {\n  // Do something\n}, {\n  some: 'thing',\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.tracePromise(async () => {\n  // Do something\n}, {\n  some: 'thing',\n});"}],"children":[]},{"kind":"method","id":"tracingchanneltracecallbackfn-position-context-thisarg-args","name":"traceCallback","title":"`tracingChannel.traceCallback(fn[, position[, context[, thisArg[, ...args]]]])`","scope":"module","overloadOf":null,"stability":null,"added":["v19.9.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"callback using function to wrap a trace around","default":null,"optional":false,"rest":false,"properties":[]},{"name":"position","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Zero-indexed argument position of expected callback\n(defaults to last argument if `undefined` is passed)","default":null,"optional":true,"rest":false,"properties":[]},{"name":"context","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Shared object to correlate trace events through (defaults\nto `{}` if `undefined` is passed)","default":null,"optional":true,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The receiver to be used for the function call","default":null,"optional":true,"rest":false,"properties":[]},{"name":"args","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"arguments to pass to the function (must include the callback)","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The return value of the given function"}},"description":"Trace a callback-receiving function call. The callback is expected to follow\nthe error as first arg convention typically used. This will always produce a\n[`start` event](#startevent) and [`end` event](#endevent) around the synchronous portion of the\nfunction execution, and will produce a [`asyncStart` event](#asyncstartevent) and\n[`asyncEnd` event](#asyncendevent) around the callback execution. It may also produce an\n[`error` event](#errorevent) if the given function throws or the first argument passed to\nthe callback is set. This will run the given function using\n[`channel.runStores(context, ...)`](#channelrunstorescontext-fn-thisarg-args) on the `start` channel which ensures all\nevents should have any bound stores set to match this trace context.\n\nTo ensure only correct trace graphs are formed, events will only be published\nif subscribers are present prior to starting the trace. Subscriptions which are\nadded after the trace begins will not receive future events from that trace,\nonly future traces will be seen.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceCallback((arg1, callback) => {\n  // Do something\n  callback(null, 'result');\n}, 1, {\n  some: 'thing',\n}, thisArg, arg1, callback);\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceCallback((arg1, callback) => {\n  // Do something\n  callback(null, 'result');\n}, 1, {\n  some: 'thing',\n}, thisArg, arg1, callback);\n```\n\nThe callback will also be run with [`channel.runStores(context, ...)`](#channelrunstorescontext-fn-thisarg-args) which\nenables context loss recovery in some cases.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\nconst myStore = new AsyncLocalStorage();\n\n// The start channel sets the initial store data to something\n// and stores that store data value on the trace context object\nchannels.start.bindStore(myStore, (data) => {\n  const span = new Span(data);\n  data.span = span;\n  return span;\n});\n\n// Then asyncStart can restore from that data it stored previously\nchannels.asyncStart.bindStore(myStore, (data) => {\n  return data.span;\n});\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\nconst myStore = new AsyncLocalStorage();\n\n// The start channel sets the initial store data to something\n// and stores that store data value on the trace context object\nchannels.start.bindStore(myStore, (data) => {\n  const span = new Span(data);\n  data.span = span;\n  return span;\n});\n\n// Then asyncStart can restore from that data it stored previously\nchannels.asyncStart.bindStore(myStore, (data) => {\n  return data.span;\n});\n```","summary":"Trace a callback-receiving function call. The callback is expected to follow the error as first arg convention typically used. This will always produce a `start` event and `end` event around the synchronous portion of the function execution, and will produce a `asyncStart` event and `asyncEnd` event around the callback execution. It may also produce an `error` event if the given function throws or the first argument passed to the callback is set. 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.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceCallback((arg1, callback) => {\n  // Do something\n  callback(null, 'result');\n}, 1, {\n  some: 'thing',\n}, thisArg, arg1, callback);"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nchannels.traceCallback((arg1, callback) => {\n  // Do something\n  callback(null, 'result');\n}, 1, {\n  some: 'thing',\n}, thisArg, arg1, callback);"},{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\nconst myStore = new AsyncLocalStorage();\n\n// The start channel sets the initial store data to something\n// and stores that store data value on the trace context object\nchannels.start.bindStore(myStore, (data) => {\n  const span = new Span(data);\n  data.span = span;\n  return span;\n});\n\n// Then asyncStart can restore from that data it stored previously\nchannels.asyncStart.bindStore(myStore, (data) => {\n  return data.span;\n});"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\nconst { AsyncLocalStorage } = require('node:async_hooks');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\nconst myStore = new AsyncLocalStorage();\n\n// The start channel sets the initial store data to something\n// and stores that store data value on the trace context object\nchannels.start.bindStore(myStore, (data) => {\n  const span = new Span(data);\n  data.span = span;\n  return span;\n});\n\n// Then asyncStart can restore from that data it stored previously\nchannels.asyncStart.bindStore(myStore, (data) => {\n  return data.span;\n});"}],"children":[]},{"kind":"property","id":"tracingchannelhassubscribers","name":"hasSubscribers","title":"`tracingChannel.hasSubscribers`","scope":"module","overloadOf":null,"stability":null,"added":["v22.0.0","v20.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if any of the individual channels has a subscriber,\n`false` if not.\n\nThis is a helper method available on a [`TracingChannel`](#class-tracingchannel) instance to check if\nany of the [TracingChannel Channels](#tracingchannel-channels) have subscribers. A `true` is returned if\nany of them have at least one subscriber, a `false` is returned otherwise.\n\n```mjs\nimport diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nif (channels.hasSubscribers) {\n  // Do something\n}\n```\n\n```cjs\nconst diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nif (channels.hasSubscribers) {\n  // Do something\n}\n```","summary":"This is a helper method available on a `TracingChannel` instance to check if any of the TracingChannel Channels have subscribers. A `true` is returned if any of them have at least one subscriber, a `false` is returned otherwise.","examples":[{"language":"mjs","displayName":null,"code":"import diagnostics_channel from 'node:diagnostics_channel';\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nif (channels.hasSubscribers) {\n  // Do something\n}"},{"language":"cjs","displayName":null,"code":"const diagnostics_channel = require('node:diagnostics_channel');\n\nconst channels = diagnostics_channel.tracingChannel('my-channel');\n\nif (channels.hasSubscribers) {\n  // Do something\n}"}],"children":[]}]},{"kind":"class","id":"class-boundedchannel","name":"BoundedChannel","title":"Class: `BoundedChannel`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The class `BoundedChannel` is a simplified version of [`TracingChannel`](#class-tracingchannel) that\nonly traces synchronous operations. It consists of two channels (`start` and\n`end`) instead of five, omitting the `asyncStart`, `asyncEnd`, and `error`\nevents. This makes it suitable for tracing operations that don't involve\nasynchronous continuations or error handling.\n\nLike `TracingChannel`, it is recommended to create and reuse a single\n`BoundedChannel` at the top-level of the file rather than creating them\ndynamically.","summary":"The class `BoundedChannel` is a simplified version of `TracingChannel` that only traces synchronous operations. It consists of two channels (`start` and `end`) instead of five, omitting the `asyncStart`, `asyncEnd`, and `error` events. This makes it suitable for tracing operations that don't involve asynchronous continuations or error handling.","examples":[],"children":[{"kind":"property","id":"boundedchannelhassubscribers","name":"hasSubscribers","title":"`boundedChannel.hasSubscribers`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if any of the individual channels has a subscriber,\n`false` if not.\n\nCheck if any of the `start` or `end` channels have subscribers.\n\n```mjs\nimport { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nif (wc.hasSubscribers) {\n  // There are subscribers, perform traced operation\n}\n```\n\n```cjs\nconst { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nif (wc.hasSubscribers) {\n  // There are subscribers, perform traced operation\n}\n```","summary":"Check if any of the `start` or `end` channels have subscribers.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nif (wc.hasSubscribers) {\n  // There are subscribers, perform traced operation\n}"},{"language":"cjs","displayName":null,"code":"const { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nif (wc.hasSubscribers) {\n  // There are subscribers, perform traced operation\n}"}],"children":[]},{"kind":"method","id":"boundedchannelsubscribehandlers","name":"subscribe","title":"`boundedChannel.subscribe(handlers)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"handlers","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Set of channel subscribers","default":null,"optional":false,"rest":false,"properties":[{"name":"start","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The start event subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"end","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The end event subscriber","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Subscribe to the bounded channel events. This is equivalent to calling\n[`channel.subscribe(onMessage)`](#channelsubscribeonmessage) on each channel individually.\n\n```mjs\nimport { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nwc.subscribe({\n  start(message) {\n    // Handle start\n  },\n  end(message) {\n    // Handle end\n  },\n});\n```\n\n```cjs\nconst { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nwc.subscribe({\n  start(message) {\n    // Handle start\n  },\n  end(message) {\n    // Handle end\n  },\n});\n```","summary":"Subscribe to the bounded channel events. This is equivalent to calling `channel.subscribe(onMessage)` on each channel individually.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nwc.subscribe({\n  start(message) {\n    // Handle start\n  },\n  end(message) {\n    // Handle end\n  },\n});"},{"language":"cjs","displayName":null,"code":"const { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nwc.subscribe({\n  start(message) {\n    // Handle start\n  },\n  end(message) {\n    // Handle end\n  },\n});"}],"children":[]},{"kind":"method","id":"boundedchannelunsubscribehandlers","name":"unsubscribe","title":"`boundedChannel.unsubscribe(handlers)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"handlers","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Set of channel subscribers","default":null,"optional":false,"rest":false,"properties":[{"name":"start","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The start event subscriber","default":null,"optional":false,"rest":false,"properties":[]},{"name":"end","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The end event subscriber","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if all handlers were successfully unsubscribed,\n`false` otherwise."}},"description":"Unsubscribe from the bounded channel events. This is equivalent to calling\n[`channel.unsubscribe(onMessage)`](#channelunsubscribeonmessage) on each channel individually.\n\n```mjs\nimport { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst handlers = {\n  start(message) {},\n  end(message) {},\n};\n\nwc.subscribe(handlers);\nwc.unsubscribe(handlers);\n```\n\n```cjs\nconst { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst handlers = {\n  start(message) {},\n  end(message) {},\n};\n\nwc.subscribe(handlers);\nwc.unsubscribe(handlers);\n```","summary":"Unsubscribe from the bounded channel events. This is equivalent to calling `channel.unsubscribe(onMessage)` on each channel individually.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst handlers = {\n  start(message) {},\n  end(message) {},\n};\n\nwc.subscribe(handlers);\nwc.unsubscribe(handlers);"},{"language":"cjs","displayName":null,"code":"const { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst handlers = {\n  start(message) {},\n  end(message) {},\n};\n\nwc.subscribe(handlers);\nwc.unsubscribe(handlers);"}],"children":[]},{"kind":"method","id":"boundedchannelruncontext-fn-thisarg-args","name":"run","title":"`boundedChannel.run(context, fn[, thisArg[, ...args]])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"context","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Shared object to correlate events through","default":null,"optional":false,"rest":false,"properties":[]},{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"Function to wrap a trace around","default":null,"optional":false,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The receiver to be used for the function call","default":null,"optional":true,"rest":false,"properties":[]},{"name":"args","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Optional arguments to pass to the function","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The return value of the given function"}},"description":"Trace a synchronous function call. This will produce a `start` event and `end`\nevent around the execution. This runs the given function using\n[`channel.runStores(context, ...)`](#channelrunstorescontext-fn-thisarg-args) on the `start` channel which ensures all\nevents have any bound stores set to match this trace context.\n\n```mjs\nimport { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst result = wc.run({ operationId: '123' }, () => {\n  // Perform operation\n  return 42;\n});\n```\n\n```cjs\nconst { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst result = wc.run({ operationId: '123' }, () => {\n  // Perform operation\n  return 42;\n});\n```","summary":"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.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst result = wc.run({ operationId: '123' }, () => {\n  // Perform operation\n  return 42;\n});"},{"language":"cjs","displayName":null,"code":"const { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst result = wc.run({ operationId: '123' }, () => {\n  // Perform operation\n  return 42;\n});"}],"children":[]},{"kind":"method","id":"boundedchannelwithscopecontext","name":"withScope","title":"`boundedChannel.withScope([context])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"context","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Shared object to correlate events through","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"BoundedChannelScope","links":[{"name":"BoundedChannelScope","href":"diagnostics_channel.html#class-boundedchannelscope","start":0,"end":19}]},"description":"Disposable scope object"}},"description":"Create a disposable scope for tracing a synchronous operation using JavaScript's\nexplicit resource management (`using` syntax). The scope automatically publishes\n`start` and `end` events, enters bound stores, and handles cleanup when disposed.\n\n```mjs\nimport { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst context = { operationId: '123' };\n{\n  using scope = wc.withScope(context);\n  // Stores are entered, start event is published\n\n  // Perform work and set result on context\n  context.result = 42;\n}\n// End event is published, stores are restored automatically\n```\n\n```cjs\nconst { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst context = { operationId: '123' };\n{\n  using scope = wc.withScope(context);\n  // Stores are entered, start event is published\n\n  // Perform work and set result on context\n  context.result = 42;\n}\n// End event is published, stores are restored automatically\n```","summary":"Create a disposable scope for tracing a synchronous operation using JavaScript's explicit resource management (`using` syntax). The scope automatically publishes `start` and `end` events, enters bound stores, and handles cleanup when disposed.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst context = { operationId: '123' };\n{\n  using scope = wc.withScope(context);\n  // Stores are entered, start event is published\n\n  // Perform work and set result on context\n  context.result = 42;\n}\n// End event is published, stores are restored automatically"},{"language":"cjs","displayName":null,"code":"const { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst context = { operationId: '123' };\n{\n  using scope = wc.withScope(context);\n  // Stores are entered, start event is published\n\n  // Perform work and set result on context\n  context.result = 42;\n}\n// End event is published, stores are restored automatically"}],"children":[]}]},{"kind":"class","id":"class-boundedchannelscope","name":"BoundedChannelScope","title":"Class: `BoundedChannelScope`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The class `BoundedChannelScope` represents a disposable scope created by\n[`boundedChannel.withScope(context)`](#boundedchannelwithscopecontext). It manages the lifecycle of a traced\noperation, automatically publishing events and managing store contexts.\n\nThe scope must be used with the `using` syntax to ensure proper disposal.\n\n```mjs\nimport { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst context = {};\n{\n  using scope = wc.withScope(context);\n  // Start event is published, stores are entered\n  context.result = performOperation();\n  // End event is automatically published at end of block\n}\n```\n\n```cjs\nconst { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst context = {};\n{\n  using scope = wc.withScope(context);\n  // Start event is published, stores are entered\n  context.result = performOperation();\n  // End event is automatically published at end of block\n}\n```","summary":"The class `BoundedChannelScope` represents a disposable scope created by `boundedChannel.withScope(context)`. It manages the lifecycle of a traced operation, automatically publishing events and managing store contexts.","examples":[{"language":"mjs","displayName":null,"code":"import { boundedChannel } from 'node:diagnostics_channel';\n\nconst wc = boundedChannel('my-operation');\n\nconst context = {};\n{\n  using scope = wc.withScope(context);\n  // Start event is published, stores are entered\n  context.result = performOperation();\n  // End event is automatically published at end of block\n}"},{"language":"cjs","displayName":null,"code":"const { boundedChannel } = require('node:diagnostics_channel');\n\nconst wc = boundedChannel('my-operation');\n\nconst context = {};\n{\n  using scope = wc.withScope(context);\n  // Start event is published, stores are entered\n  context.result = performOperation();\n  // End event is automatically published at end of block\n}"}],"children":[]},{"kind":"section","id":"boundedchannel-channels","name":"BoundedChannel Channels","title":"BoundedChannel Channels","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"A `BoundedChannel` consists of two diagnostics channels representing the\nlifecycle of a scope created with the `using` syntax:\n\n* `tracing:${name}:start` - Published when the `using` statement executes (scope creation)\n* `tracing:${name}:end` - Published when exiting the block (scope disposal)\n\nWhen using the `using` syntax with \\[`boundedChannel.withScope([context])`]\\[], the `start`\nevent is published immediately when the statement executes, and the `end` event\nis automatically published when disposal occurs at the end of the block. All\nevents share the same context object, which can be extended with additional\nproperties like `result` during scope execution.","summary":"A `BoundedChannel` consists of two diagnostics channels representing the lifecycle of a scope created with the `using` syntax:","examples":[],"children":[]},{"kind":"section","id":"tracingchannel-channels","name":"TracingChannel Channels","title":"TracingChannel Channels","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"A TracingChannel is a collection of several diagnostics\\_channels representing\nspecific points in the execution lifecycle of a single traceable action. The\nbehavior is split into five diagnostics\\_channels consisting of `start`,\n`end`, `asyncStart`, `asyncEnd`, and `error`. A single traceable action will\nshare the same event object between all events, this can be helpful for\nmanaging correlation through a weakmap.\n\nThese event objects will be extended with `result` or `error` values when\nthe task \"completes\". In the case of a synchronous task the `result` will be\nthe return value and the `error` will be anything thrown from the function.\nWith callback-based async functions the `result` will be the second argument\nof the callback while the `error` will either be a thrown error visible in the\n`end` event or the first callback argument in either of the `asyncStart` or\n`asyncEnd` events.\n\nTo ensure only correct trace graphs are formed, events should only be published\nif subscribers are present prior to starting the trace. Subscriptions which are\nadded after the trace begins should not receive future events from that trace,\nonly future traces will be seen.\n\nTracing channels should follow a naming pattern of:\n\n* `tracing:module.class.method:start` or `tracing:module.function:start`\n* `tracing:module.class.method:end` or `tracing:module.function:end`\n* `tracing:module.class.method:asyncStart` or `tracing:module.function:asyncStart`\n* `tracing:module.class.method:asyncEnd` or `tracing:module.function:asyncEnd`\n* `tracing:module.class.method:error` or `tracing:module.function:error`","summary":"A TracingChannel is a collection of several diagnostics_channels representing specific points in the execution lifecycle of a single traceable action. The behavior is split into five diagnostics_channels consisting of `start`, `end`, `asyncStart`, `asyncEnd`, and `error`. A single traceable action will share the same event object between all events, this can be helpful for managing correlation through a weakmap.","examples":[],"children":[{"kind":"method","id":"startevent","name":"start","title":"`start(event)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"event","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"* Name: `tracing:${name}:start`\n\nThe `start` event represents the point at which a function is called. At this\npoint the event data may contain function arguments or anything else available\nat the very start of the execution of the function.","summary":"The `start` event represents the point at which a function is called. At this point the event data may contain function arguments or anything else available at the very start of the execution of the function.","examples":[],"children":[]},{"kind":"method","id":"endevent","name":"end","title":"`end(event)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"event","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"* Name: `tracing:${name}:end`\n\nThe `end` event represents the point at which a function call returns a value.\nIn the case of an async function this is when the promise returned not when the\nfunction itself makes a return statement internally. At this point, if the\ntraced function was synchronous the `result` field will be set to the return\nvalue of the function. Alternatively, the `error` field may be present to\nrepresent any thrown errors.\n\nIt is recommended to listen specifically to the `error` event to track errors\nas it may be possible for a traceable action to produce multiple errors. For\nexample, an async task which fails may be started internally before the sync\npart of the task then throws an error.","summary":"The `end` event represents the point at which a function call returns a value. In the case of an async function this is when the promise returned not when the function itself makes a return statement internally. At this point, if the traced function was synchronous the `result` field will be set to the return value of the function. Alternatively, the `error` field may be present to represent any thrown errors.","examples":[],"children":[]},{"kind":"method","id":"asyncstartevent","name":"asyncStart","title":"`asyncStart(event)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"event","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"* Name: `tracing:${name}:asyncStart`\n\nThe `asyncStart` event represents the callback or continuation of a traceable\nfunction being reached. At this point things like callback arguments may be\navailable, or anything else expressing the \"result\" of the action.\n\nFor callbacks-based functions, the first argument of the callback will be\nassigned to the `error` field, if not `undefined` or `null`, and the second\nargument will be assigned to the `result` field.\n\nFor promises, the argument to the `resolve` path will be assigned to `result`\nor the argument to the `reject` path will be assign to `error`.\n\nIt is recommended to listen specifically to the `error` event to track errors\nas it may be possible for a traceable action to produce multiple errors. For\nexample, an async task which fails may be started internally before the sync\npart of the task then throws an error.","summary":"The `asyncStart` event represents the callback or continuation of a traceable function being reached. At this point things like callback arguments may be available, or anything else expressing the \"result\" of the action.","examples":[],"children":[]},{"kind":"method","id":"asyncendevent","name":"asyncEnd","title":"`asyncEnd(event)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"event","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"* Name: `tracing:${name}:asyncEnd`\n\nThe `asyncEnd` event represents the callback of an asynchronous function\nreturning. It's not likely event data will change after the `asyncStart` event,\nhowever it may be useful to see the point where the callback completes.","summary":"The `asyncEnd` event represents the callback of an asynchronous function returning. It's not likely event data will change after the `asyncStart` event, however it may be useful to see the point where the callback completes.","examples":[],"children":[]},{"kind":"method","id":"errorevent","name":"error","title":"`error(event)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"event","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"* Name: `tracing:${name}:error`\n\nThe `error` event represents any error produced by the traceable function\neither synchronously or asynchronously. If an error is thrown in the\nsynchronous portion of the traced function the error will be assigned to the\n`error` field of the event and the `error` event will be triggered. If an error\nis received asynchronously through a callback or promise rejection it will also\nbe assigned to the `error` field of the event and trigger the `error` event.\n\nIt is possible for a single traceable function call to produce errors multiple\ntimes so this should be considered when consuming this event. For example, if\nanother async task is triggered internally which fails and then the sync part\nof the function then throws and error two `error` events will be emitted, one\nfor the sync error and one for the async error.","summary":"The `error` event represents any error produced by the traceable function either synchronously or asynchronously. If an error is thrown in the synchronous portion of the traced function the error will be assigned to the `error` field of the event and the `error` event will be triggered. If an error is received asynchronously through a callback or promise rejection it will also be assigned to the `error` field of the event and trigger the `error` event.","examples":[],"children":[]}]},{"kind":"section","id":"built-in-channels","name":"Built-in Channels","title":"Built-in Channels","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"section","id":"console","name":"Console","title":"Console","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-consolelog","name":"console.log","title":"Event: `'console.log'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"args","type":{"text":"any[]","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when `console.log()` is called. Receives and array of the arguments\npassed to `console.log()`.","summary":"Emitted when `console.log()` is called. Receives and array of the arguments passed to `console.log()`.","examples":[],"children":[]},{"kind":"event","id":"event-consoleinfo","name":"console.info","title":"Event: `'console.info'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"args","type":{"text":"any[]","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when `console.info()` is called. Receives and array of the arguments\npassed to `console.info()`.","summary":"Emitted when `console.info()` is called. Receives and array of the arguments passed to `console.info()`.","examples":[],"children":[]},{"kind":"event","id":"event-consoledebug","name":"console.debug","title":"Event: `'console.debug'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"args","type":{"text":"any[]","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when `console.debug()` is called. Receives and array of the arguments\npassed to `console.debug()`.","summary":"Emitted when `console.debug()` is called. Receives and array of the arguments passed to `console.debug()`.","examples":[],"children":[]},{"kind":"event","id":"event-consolewarn","name":"console.warn","title":"Event: `'console.warn'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"args","type":{"text":"any[]","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when `console.warn()` is called. Receives and array of the arguments\npassed to `console.warn()`.","summary":"Emitted when `console.warn()` is called. Receives and array of the arguments passed to `console.warn()`.","examples":[],"children":[]},{"kind":"event","id":"event-consoleerror","name":"console.error","title":"Event: `'console.error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"args","type":{"text":"any[]","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when `console.error()` is called. Receives and array of the arguments\npassed to `console.error()`.","summary":"Emitted when `console.error()` is called. Receives and array of the arguments passed to `console.error()`.","examples":[],"children":[]}]},{"kind":"section","id":"http","name":"HTTP","title":"HTTP","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-httpclientrequestcreated","name":"http.client.request.created","title":"Event: `'http.client.request.created'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.ClientRequest","links":[{"name":"http.ClientRequest","href":"http.html#class-httpclientrequest","start":0,"end":18}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when client creates a request object.\nUnlike `http.client.request.start`, this event is emitted before the request has been sent.","summary":"Emitted when client creates a request object. Unlike `http.client.request.start`, this event is emitted before the request has been sent.","examples":[],"children":[]},{"kind":"event","id":"event-httpclientrequeststart","name":"http.client.request.start","title":"Event: `'http.client.request.start'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.ClientRequest","links":[{"name":"http.ClientRequest","href":"http.html#class-httpclientrequest","start":0,"end":18}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when client starts a request.","summary":"Emitted when client starts a request.","examples":[],"children":[]},{"kind":"event","id":"event-httpclientrequesterror","name":"http.client.request.error","title":"Event: `'http.client.request.error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.ClientRequest","links":[{"name":"http.ClientRequest","href":"http.html#class-httpclientrequest","start":0,"end":18}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when an error occurs during a client request.","summary":"Emitted when an error occurs during a client request.","examples":[],"children":[]},{"kind":"event","id":"event-httpclientresponsefinish","name":"http.client.response.finish","title":"Event: `'http.client.response.finish'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.ClientRequest","links":[{"name":"http.ClientRequest","href":"http.html#class-httpclientrequest","start":0,"end":18}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"response","type":{"text":"http.IncomingMessage","links":[{"name":"http.IncomingMessage","href":"http.html#class-httpincomingmessage","start":0,"end":20}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when client receives a response.","summary":"Emitted when client receives a response.","examples":[],"children":[]},{"kind":"event","id":"event-httpserverrequeststart","name":"http.server.request.start","title":"Event: `'http.server.request.start'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.IncomingMessage","links":[{"name":"http.IncomingMessage","href":"http.html#class-httpincomingmessage","start":0,"end":20}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"response","type":{"text":"http.ServerResponse","links":[{"name":"http.ServerResponse","href":"http.html#class-httpserverresponse","start":0,"end":19}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"socket","type":{"text":"net.Socket","links":[{"name":"net.Socket","href":"net.html#class-netsocket","start":0,"end":10}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"server","type":{"text":"http.Server","links":[{"name":"http.Server","href":"http.html#class-httpserver","start":0,"end":11}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when server receives a request.","summary":"Emitted when server receives a request.","examples":[],"children":[]},{"kind":"event","id":"event-httpserverresponsecreated","name":"http.server.response.created","title":"Event: `'http.server.response.created'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.IncomingMessage","links":[{"name":"http.IncomingMessage","href":"http.html#class-httpincomingmessage","start":0,"end":20}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"response","type":{"text":"http.ServerResponse","links":[{"name":"http.ServerResponse","href":"http.html#class-httpserverresponse","start":0,"end":19}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when server creates a response.\nThe event is emitted before the response is sent.","summary":"Emitted when server creates a response. The event is emitted before the response is sent.","examples":[],"children":[]},{"kind":"event","id":"event-httpserverresponsefinish","name":"http.server.response.finish","title":"Event: `'http.server.response.finish'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"request","type":{"text":"http.IncomingMessage","links":[{"name":"http.IncomingMessage","href":"http.html#class-httpincomingmessage","start":0,"end":20}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"response","type":{"text":"http.ServerResponse","links":[{"name":"http.ServerResponse","href":"http.html#class-httpserverresponse","start":0,"end":19}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"socket","type":{"text":"net.Socket","links":[{"name":"net.Socket","href":"net.html#class-netsocket","start":0,"end":10}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"server","type":{"text":"http.Server","links":[{"name":"http.Server","href":"http.html#class-httpserver","start":0,"end":11}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when server sends a response.","summary":"Emitted when server sends a response.","examples":[],"children":[]}]},{"kind":"section","id":"http2","name":"HTTP/2","title":"HTTP/2","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-http2clientstreamcreated","name":"http2.client.stream.created","title":"Event: `'http2.client.stream.created'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"headers","type":{"text":"HTTP/2 Headers Object","links":[{"name":"HTTP/2 Headers Object","href":"http2.html#headers-object","start":0,"end":21}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is created on the client.","summary":"Emitted when a stream is created on the client.","examples":[],"children":[]},{"kind":"event","id":"event-http2clientstreamstart","name":"http2.client.stream.start","title":"Event: `'http2.client.stream.start'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"headers","type":{"text":"HTTP/2 Headers Object","links":[{"name":"HTTP/2 Headers Object","href":"http2.html#headers-object","start":0,"end":21}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is started on the client.","summary":"Emitted when a stream is started on the client.","examples":[],"children":[]},{"kind":"event","id":"event-http2clientstreamerror","name":"http2.client.stream.error","title":"Event: `'http2.client.stream.error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when an error occurs during the processing of a stream on the client.","summary":"Emitted when an error occurs during the processing of a stream on the client.","examples":[],"children":[]},{"kind":"event","id":"event-http2clientstreamfinish","name":"http2.client.stream.finish","title":"Event: `'http2.client.stream.finish'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"headers","type":{"text":"HTTP/2 Headers Object","links":[{"name":"HTTP/2 Headers Object","href":"http2.html#headers-object","start":0,"end":21}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"flags","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is received on the client.","summary":"Emitted when a stream is received on the client.","examples":[],"children":[]},{"kind":"event","id":"event-http2clientstreambodychunksent","name":"http2.client.stream.bodyChunkSent","title":"Event: `'http2.client.stream.bodyChunkSent'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"writev","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | string | Buffer[] | Object[]","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":9,"end":15},{"name":"Buffer","href":"buffer.html#class-buffer","start":18,"end":24},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":29,"end":35}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"chunk","type":{"text":"Buffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":9,"end":15}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"encoding","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"encoding","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a chunk of the client stream body is being sent.","summary":"Emitted when a chunk of the client stream body is being sent.","examples":[],"children":[]},{"kind":"event","id":"event-http2clientstreambodysent","name":"http2.client.stream.bodySent","title":"Event: `'http2.client.stream.bodySent'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted after the client stream body has been fully sent.","summary":"Emitted after the client stream body has been fully sent.","examples":[],"children":[]},{"kind":"event","id":"event-http2clientstreamclose","name":"http2.client.stream.close","title":"Event: `'http2.client.stream.close'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ClientHttp2Stream","links":[{"name":"ClientHttp2Stream","href":"http2.html#class-clienthttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is closed on the client. The HTTP/2 error code used when\nclosing the stream can be retrieved using the `stream.rstCode` property.","summary":"Emitted when a stream is closed on the client. The HTTP/2 error code used when closing the stream can be retrieved using the `stream.rstCode` property.","examples":[],"children":[]},{"kind":"event","id":"event-http2serverstreamcreated","name":"http2.server.stream.created","title":"Event: `'http2.server.stream.created'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ServerHttp2Stream","links":[{"name":"ServerHttp2Stream","href":"http2.html#class-serverhttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"headers","type":{"text":"HTTP/2 Headers Object","links":[{"name":"HTTP/2 Headers Object","href":"http2.html#headers-object","start":0,"end":21}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is created on the server.","summary":"Emitted when a stream is created on the server.","examples":[],"children":[]},{"kind":"event","id":"event-http2serverstreamstart","name":"http2.server.stream.start","title":"Event: `'http2.server.stream.start'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ServerHttp2Stream","links":[{"name":"ServerHttp2Stream","href":"http2.html#class-serverhttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"headers","type":{"text":"HTTP/2 Headers Object","links":[{"name":"HTTP/2 Headers Object","href":"http2.html#headers-object","start":0,"end":21}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is started on the server.","summary":"Emitted when a stream is started on the server.","examples":[],"children":[]},{"kind":"event","id":"event-http2serverstreamerror","name":"http2.server.stream.error","title":"Event: `'http2.server.stream.error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ServerHttp2Stream","links":[{"name":"ServerHttp2Stream","href":"http2.html#class-serverhttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when an error occurs during the processing of a stream on the server.","summary":"Emitted when an error occurs during the processing of a stream on the server.","examples":[],"children":[]},{"kind":"event","id":"event-http2serverstreamfinish","name":"http2.server.stream.finish","title":"Event: `'http2.server.stream.finish'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ServerHttp2Stream","links":[{"name":"ServerHttp2Stream","href":"http2.html#class-serverhttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"headers","type":{"text":"HTTP/2 Headers Object","links":[{"name":"HTTP/2 Headers Object","href":"http2.html#headers-object","start":0,"end":21}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"flags","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is sent on the server.","summary":"Emitted when a stream is sent on the server.","examples":[],"children":[]},{"kind":"event","id":"event-http2serverstreamclose","name":"http2.server.stream.close","title":"Event: `'http2.server.stream.close'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"stream","type":{"text":"ServerHttp2Stream","links":[{"name":"ServerHttp2Stream","href":"http2.html#class-serverhttp2stream","start":0,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a stream is closed on the server. The HTTP/2 error code used when\nclosing the stream can be retrieved using the `stream.rstCode` property.","summary":"Emitted when a stream is closed on the server. The HTTP/2 error code used when closing the stream can be retrieved using the `stream.rstCode` property.","examples":[],"children":[]}]},{"kind":"section","id":"modules","name":"Modules","title":"Modules","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-tracingmodulerequirestart","name":"tracing:module.require:start","title":"Event: `'tracing:module.require:start'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"event","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"containing the following properties","default":null,"optional":false,"rest":false,"properties":[{"name":"id","type":null,"description":"Argument passed to `require()`. Module name.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"parentFilename","type":null,"description":"Name of the module that attempted to require(id).","default":null,"optional":false,"rest":false,"properties":[]}]}],"description":"Emitted when `require()` is executed. See [`start` event](#startevent).","summary":"Emitted when `require()` is executed. See `start` event.","examples":[],"children":[]},{"kind":"event","id":"event-tracingmodulerequireend","name":"tracing:module.require:end","title":"Event: `'tracing:module.require:end'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"event","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"containing the following properties","default":null,"optional":false,"rest":false,"properties":[{"name":"id","type":null,"description":"Argument passed to `require()`. Module name.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"parentFilename","type":null,"description":"Name of the module that attempted to require(id).","default":null,"optional":false,"rest":false,"properties":[]}]}],"description":"Emitted when a `require()` call returns. See [`end` event](#endevent).","summary":"Emitted when a `require()` call returns. See `end` event.","examples":[],"children":[]},{"kind":"event","id":"event-tracingmodulerequireerror","name":"tracing:module.require:error","title":"Event: `'tracing:module.require:error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"event","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"containing the following properties","default":null,"optional":false,"rest":false,"properties":[{"name":"id","type":null,"description":"Argument passed to `require()`. Module name.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"parentFilename","type":null,"description":"Name of the module that attempted to require(id).","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"error","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a `require()` throws an error. See [`error` event](#errorevent).","summary":"Emitted when a `require()` throws an error. See `error` event.","examples":[],"children":[]},{"kind":"event","id":"event-tracingmoduleimportasyncstart","name":"tracing:module.import:asyncStart","title":"Event: `'tracing:module.import:asyncStart'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"event","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"containing the following properties","default":null,"optional":false,"rest":false,"properties":[{"name":"id","type":null,"description":"Argument passed to `import()`. Module name.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"parentURL","type":null,"description":"URL object of the module that attempted to import(id).","default":null,"optional":false,"rest":false,"properties":[]}]}],"description":"Emitted when `import()` is invoked. See [`asyncStart` event](#asyncstartevent).","summary":"Emitted when `import()` is invoked. See `asyncStart` event.","examples":[],"children":[]},{"kind":"event","id":"event-tracingmoduleimportasyncend","name":"tracing:module.import:asyncEnd","title":"Event: `'tracing:module.import:asyncEnd'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"event","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"containing the following properties","default":null,"optional":false,"rest":false,"properties":[{"name":"id","type":null,"description":"Argument passed to `import()`. Module name.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"parentURL","type":null,"description":"URL object of the module that attempted to import(id).","default":null,"optional":false,"rest":false,"properties":[]}]}],"description":"Emitted when `import()` has completed. See [`asyncEnd` event](#asyncendevent).","summary":"Emitted when `import()` has completed. See `asyncEnd` event.","examples":[],"children":[]},{"kind":"event","id":"event-tracingmoduleimporterror","name":"tracing:module.import:error","title":"Event: `'tracing:module.import:error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"event","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"containing the following properties","default":null,"optional":false,"rest":false,"properties":[{"name":"id","type":null,"description":"Argument passed to `import()`. Module name.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"parentURL","type":null,"description":"URL object of the module that attempted to import(id).","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"error","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a `import()` throws an error. See [`error` event](#errorevent).","summary":"Emitted when a `import()` throws an error. See `error` event.","examples":[],"children":[]}]},{"kind":"section","id":"net","name":"NET","title":"NET","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-netclientsocket","name":"net.client.socket","title":"Event: `'net.client.socket'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"socket","type":{"text":"net.Socket | tls.TLSSocket","links":[{"name":"net.Socket","href":"net.html#class-netsocket","start":0,"end":10},{"name":"tls.TLSSocket","href":"tls.html#tlstlssocket","start":13,"end":26}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a new TCP or pipe client socket connection is created.","summary":"Emitted when a new TCP or pipe client socket connection is created.","examples":[],"children":[]},{"kind":"event","id":"event-netserversocket","name":"net.server.socket","title":"Event: `'net.server.socket'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"socket","type":{"text":"net.Socket","links":[{"name":"net.Socket","href":"net.html#class-netsocket","start":0,"end":10}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a new TCP or pipe connection is received.","summary":"Emitted when a new TCP or pipe connection is received.","examples":[],"children":[]},{"kind":"event","id":"event-tracingnetserverlistenasyncstart","name":"tracing:net.server.listen:asyncStart","title":"Event: `'tracing:net.server.listen:asyncStart'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"server","type":{"text":"net.Server","links":[{"name":"net.Server","href":"net.html#class-netserver","start":0,"end":10}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when [`net.Server.listen()`](net.html#serverlisten) is invoked, before the port or pipe is actually setup.","summary":"Emitted when `net.Server.listen()` is invoked, before the port or pipe is actually setup.","examples":[],"children":[]},{"kind":"event","id":"event-tracingnetserverlistenasyncend","name":"tracing:net.server.listen:asyncEnd","title":"Event: `'tracing:net.server.listen:asyncEnd'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"server","type":{"text":"net.Server","links":[{"name":"net.Server","href":"net.html#class-netserver","start":0,"end":10}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when [`net.Server.listen()`](net.html#serverlisten) has completed and thus the server is ready to accept connection.","summary":"Emitted when `net.Server.listen()` has completed and thus the server is ready to accept connection.","examples":[],"children":[]},{"kind":"event","id":"event-tracingnetserverlistenerror","name":"tracing:net.server.listen:error","title":"Event: `'tracing:net.server.listen:error'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"server","type":{"text":"net.Server","links":[{"name":"net.Server","href":"net.html#class-netserver","start":0,"end":10}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when [`net.Server.listen()`](net.html#serverlisten) is returning an error.","summary":"Emitted when `net.Server.listen()` is returning an error.","examples":[],"children":[]}]},{"kind":"section","id":"udp","name":"UDP","title":"UDP","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-udpsocket","name":"udp.socket","title":"Event: `'udp.socket'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"socket","type":{"text":"dgram.Socket","links":[{"name":"dgram.Socket","href":"dgram.html#class-dgramsocket","start":0,"end":12}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a new UDP socket is created.","summary":"Emitted when a new UDP socket is created.","examples":[],"children":[]}]},{"kind":"section","id":"process","name":"Process","title":"Process","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v16.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-child_process","name":"child_process","title":"Event: `'child_process'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"process","type":{"text":"ChildProcess","links":[{"name":"ChildProcess","href":"child_process.html#class-childprocess","start":0,"end":12}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a new process is created.\n\n`tracing:child_process.spawn:start`\n\n* `process` {ChildProcess}\n* `options` {Object}\n\nEmitted when [`child_process.spawn()`](child_process.html#child_processspawncommand-args-options) is invoked, before the process is\nactually spawned.\n\n`tracing:child_process.spawn:end`\n\n* `process` {ChildProcess}\n\nEmitted when [`child_process.spawn()`](child_process.html#child_processspawncommand-args-options) has completed successfully and the\nprocess has been created.\n\n`tracing:child_process.spawn:error`\n\n* `process` {ChildProcess}\n* `error` {Error}\n\nEmitted when [`child_process.spawn()`](child_process.html#child_processspawncommand-args-options) encounters an error.","summary":"Emitted when a new process is created.","examples":[],"children":[]},{"kind":"event","id":"event-processexecve","name":"process.execve","title":"Event: `'process.execve'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"execPath","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"args","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"env","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when [`process.execve()`](process.html#processexecvefile-args-env) is invoked.","summary":"Emitted when `process.execve()` is invoked.","examples":[],"children":[]}]},{"kind":"section","id":"web-locks","name":"Web Locks","title":"Web Locks","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"These channels are emitted for each [`locks.request()`](worker_threads.html#locksrequestname-options-callback) call. See\n[`worker_threads.locks`](worker_threads.html#worker_threadslocks) for details on Web Locks.","summary":"These channels are emitted for each `locks.request()` call. See `worker_threads.locks` for details on Web Locks.","examples":[],"children":[{"kind":"event","id":"event-locksrequeststart","name":"locks.request.start","title":"Event: `'locks.request.start'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the requested lock resource.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The lock mode: `'exclusive'` or `'shared'`.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a lock request is initiated, before the lock is granted.","summary":"Emitted when a lock request is initiated, before the lock is granted.","examples":[],"children":[]},{"kind":"event","id":"event-locksrequestgrant","name":"locks.request.grant","title":"Event: `'locks.request.grant'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the requested lock resource.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The lock mode: `'exclusive'` or `'shared'`.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a lock is successfully granted and the callback is about to run.","summary":"Emitted when a lock is successfully granted and the callback is about to run.","examples":[],"children":[]},{"kind":"event","id":"event-locksrequestmiss","name":"locks.request.miss","title":"Event: `'locks.request.miss'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the requested lock resource.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The lock mode: `'exclusive'` or `'shared'`.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when `ifAvailable` is `true` and the lock is not immediately available,\nand the request callback is invoked with `null` instead of a `Lock` object.","summary":"Emitted when `ifAvailable` is `true` and the lock is not immediately available, and the request callback is invoked with `null` instead of a `Lock` object.","examples":[],"children":[]},{"kind":"event","id":"event-locksrequestend","name":"locks.request.end","title":"Event: `'locks.request.end'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the requested lock resource.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The lock mode: `'exclusive'` or `'shared'`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"steal","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether the request uses steal semantics.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"ifAvailable","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether the request uses ifAvailable semantics.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"Error | undefined","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":8,"end":17}]},"description":"The error thrown by the callback, if any.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a lock request has finished, whether the callback succeeded,\nthrew an error, or the lock was stolen.","summary":"Emitted when a lock request has finished, whether the callback succeeded, threw an error, or the lock was stolen.","examples":[],"children":[]}]},{"kind":"section","id":"worker-thread","name":"Worker Thread","title":"Worker Thread","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v16.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-worker_threads","name":"worker_threads","title":"Event: `'worker_threads'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"worker","type":{"text":"Worker","links":[{"name":"Worker","href":"worker_threads.html#class-worker","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when a new thread is created.","summary":"Emitted when a new thread is created.","examples":[],"children":[]}]},{"kind":"section","id":"sqlite","name":"SQLite","title":"SQLite","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"event","id":"event-sqlitedbquery","name":"sqlite.db.query","title":"Event: `'sqlite.db.query'`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"sql","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The expanded SQL with bound parameter values substituted.\nIf expansion fails, the source SQL with unsubstituted placeholders is used\ninstead.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"database","type":{"text":"DatabaseSync","links":[{"name":"DatabaseSync","href":"sqlite.html#class-databasesync","start":0,"end":12}]},"description":"The [`DatabaseSync`](sqlite.html#class-databasesync) instance that executed the\nstatement.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"duration","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"SQLite's internal estimate of the statement run time in\nnanoseconds. This reflects C-layer execution time only and does not include\nJavaScript binding overhead such as argument marshaling or result-row\nconstruction.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted after a SQL statement finishes executing against a [`DatabaseSync`](sqlite.html#class-databasesync)\ninstance. This is a **profiling** event: it fires once per statement upon\ncompletion and reports an estimated duration from SQLite's internal profiler.\nIt is not a distributed-tracing span. There is no corresponding start event,\nno async context propagation, and no parent-span linkage. If you need\nOpenTelemetry-compatible spans or async context propagation, wrap your SQLite\ncalls with a [`TracingChannel`](#class-tracingchannel) at the JavaScript layer instead.\n\nPublishing is zero-overhead when there are no subscribers.\n\nNo event is emitted for a statement that is abandoned mid-iteration and later\nfinalized, either explicitly through [`statement.close()`](sqlite.html#statementclose) or when the\nstatement is garbage collected. Subscribers must not close the database or the\nstatement, since both are still in use while the event is being delivered; see\n[`database.close()`](sqlite.html#databaseclose) and [`statement.close()`](sqlite.html#statementclose).","summary":"Emitted after a SQL statement finishes executing against a `DatabaseSync` instance. This is a **profiling** event: it fires once per statement upon completion and reports an estimated duration from SQLite's internal profiler. It is not a distributed-tracing span. There is no corresponding start event, no async context propagation, and no parent-span linkage. If you need OpenTelemetry-compatible spans or async context propagation, wrap your SQLite calls with a `TracingChannel` at the JavaScript layer instead.","examples":[],"children":[]}]}]}]}]}