What is @opentelemetry/instrumentation-dns?
@opentelemetry/instrumentation-dns is an npm package that provides automatic instrumentation for DNS operations in Node.js applications. It helps in collecting and reporting telemetry data for DNS queries, which can be useful for monitoring and debugging purposes.
What are @opentelemetry/instrumentation-dns's main functionalities?
Automatic DNS Query Instrumentation
This feature allows you to automatically instrument DNS queries in your Node.js application. The code sample demonstrates how to set up the DNS instrumentation using the OpenTelemetry SDK.
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns');
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
new DnsInstrumentation(),
],
tracerProvider: provider,
});
Other packages similar to @opentelemetry/instrumentation-dns
dd-trace
dd-trace is the Datadog APM client for Node.js. It provides automatic instrumentation for various libraries, including DNS operations. Compared to @opentelemetry/instrumentation-dns, dd-trace is more tightly integrated with the Datadog ecosystem and offers additional features like custom metrics and traces.
newrelic
newrelic is the New Relic Node.js agent that provides automatic instrumentation for a wide range of Node.js modules, including DNS. It offers comprehensive monitoring and analytics features. Compared to @opentelemetry/instrumentation-dns, newrelic provides a more extensive set of features but is tied to the New Relic platform.
elastic-apm-node
elastic-apm-node is the official Elastic APM agent for Node.js. It provides automatic instrumentation for DNS queries and other Node.js modules. Compared to @opentelemetry/instrumentation-dns, elastic-apm-node is designed to work seamlessly with the Elastic APM stack, offering deep integration with Elasticsearch and Kibana.
OpenTelemetry DNS Instrumentation for Node.js
This module provides automatic instrumentation for the dns
module, which may be loaded using the @opentelemetry/sdk-trace-node
package and is included in the @opentelemetry/auto-instrumentations-node
bundle.
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+
.
Status
Installation
npm install --save @opentelemetry/instrumentation-dns
Supported Versions
Usage
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
new DnsInstrumentation({
}),
],
});
DNS Instrumentation Options
DNS instrumentation has currently one option. You can set the following:
Options | Type | Description |
---|
ignoreHostnames | IgnoreMatcher | IgnoreMatcher[] | DNS instrumentation will not trace all requests that match hostnames |
Semantic Conventions
This package does not currently generate any attributes from semantic conventions.
Useful links
License
Apache 2.0 - See LICENSE for more information.