The official Splunk documentation for this page is Instrument a Node application automatically. For instructions on how to contribute to the docs, see CONTRIBUTING.md.
If you set up tracing manually by calling the startTracing()
method, you can use custom or third-party instrumentations as long as they implement the OpenTelemetry JS Instrumentation interface. Custom instrumentations can be enabled by passing them to the startTracing()
method as follows:
const { startTracing } = require('@splunk/otel');
startTracing({
instrumentations: [
new MyCustomInstrumentation(),
new AnotherInstrumentation(),
]
});
You can also add the default set of instrumentation to the list as follows:
const { startTracing } = require('@splunk/otel');
const { getInstrumentations } = require('@splunk/otel/lib/instrumentations');
startTracing({
instrumentations: [
...getInstrumentations(),
new MyCustomInstrumentation(),
new AnotherInstrumentation(),
]
});