npm.io
0.65.0 • Published 1 month ago

@opentelemetry/instrumentation-net

Licence
Apache-2.0
Version
0.65.0
Deps
2
Size
51 kB
Vulns
0
Weekly
0
Stars
918

OpenTelemetry Net module Instrumentation for Node.js

NPM Published Version Apache License

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.

Installation

npm install --save @opentelemetry/instrumentation-net

Supported Versions

  • Node.js >=14

Usage

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(); });

Semantic Conventions

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.

License

Apache 2.0 - See LICENSE for more information.

Keywords