This module provides automatic instrumentation for the net module.
If total installation size is not constrained, it is recommended to use the @opentelemetry/auto-instrumentations-node bundle with @opentelemetry/sdk-node for the most seamless instrumentation experience.
Compatible with OpenTelemetry JS API and SDK 1.0+.
Supports both TCP and IPC connections.
npm install --save @opentelemetry/instrumentation-net- Node.js
>=14
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { NetInstrumentation } = require('@opentelemetry/instrumentation-net');
const sdk = new NodeSDK({
instrumentations: [
new NetInstrumentation(),
],
});
sdk.start();
process.once('beforeExit', async () => { await sdk.shutdown(); });This instrumentation uses stable semantic conventions for networking attributes.
The instrumentation-net versions 0.64.0 and later emit the stable v1.23.0+ semantic conventions.
| Attribute | Description |
|---|---|
network.transport |
One of tcp or pipe |
server.address |
Host name or the IPC file path |
server.port |
Remote port number |
network.peer.address |
Peer address of the network connection - IP address or Unix domain socket name. |
network.local.address |
Local address of the network connection - IP address or Unix domain socket name. |
network.local.port |
Local port number of the network connection. |
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For help or feedback on this project, join us in GitHub Discussions
Apache 2.0 - See LICENSE for more information.