OpenTelemetry DNS Instrumentation for Node.js
This module provides automatic instrumentation for dns
.
For automatic instrumentation see the @opentelemetry/node package.
Installation
npm install --save @opentelemetry/plugin-dns
Usage
const { NodeTracerProvider } = require('@opentelemetry/node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
{
plugins: {
dns: {
enabled: true,
// You may use a package name or absolute path to the file.
path: '@opentelemetry/plugin-dns',
// dns plugin options
}
}
},
],
tracerProvider: provider,
});
Zipkin
If you use Zipkin, you must use ignoreHostnames
in order to not trace those calls. If the server is local. You can set :
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
{
plugins: {
dns: {
enabled: true,
// You may use a package name or absolute path to the file.
path: '@opentelemetry/plugin-dns',
ignoreHostnames: ['localhost']
}
}
},
],
tracerProvider: provider,
});
Dns Plugin Options
Dns plugin has currently one option. You can set the following:
Options | Type | Description |
---|---|---|
ignoreHostnames |
IgnoreMatcher[] |
Dns plugin will not trace all requests that match hostnames |
Useful links
- 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
License
Apache 2.0 - See LICENSE for more information.