opentelemetry-instrumentation-node-cache
v0.41.0
Published
open telemetry instrumentation for the `node-cache`
Downloads
5,091
Maintainers
Readme
OpenTelemetry node-cache Instrumentation for Node.js
This module provides automatic instrumentation for node-cache
.
Supports versions >=5.0.0 of node-cache
Installation
npm install --save opentelemetry-instrumentation-node-cache
Usage
For further automatic instrumentation instruction see the @opentelemetry/instrumentation package.
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { NodeCacheInstrumentation } = require('opentelemetry-instrumentation-node-cache');
registerInstrumentations({
tracerProvider,
instrumentations: [
new NodeCacheInstrumentation({
// see under for available configuration
})
]
});
node-cache Instrumentation Options
node-cache instrumentation has few options available to choose from. You can set the following:
| Option | Type | Description |
| --- | --- | --- |
| requestHook
| function | Hook for adding custom attributes before express start handling the request. Receives params: span, { moduleVersion, operation, args }
|
| responseHook
| function | Hook called before response is returned, which allows to add custom attributes to span.Function receive params: span, { operation, response }
|
| requireParentSpan
| boolean
| Set to true if you only want to trace operation which has parent spans |
See the tests for config usage example.
This extension (and many others) was developed by Aspecto with ❤️