Branch | Status | Support level | Node.js Versions |
---|---|---|---|
main | Preview | 20, 18 |
This module provides automatic instrumentation for the @azure/functions
module, which may be loaded using the @opentelemetry/sdk-trace-node
package.
Compatible with OpenTelemetry JS API and SDK 1.0+
.
npm install --save @azure/functions-opentelemetry-instrumentation
- @azure/functions:
^4.5.0
To load the instrumentation, specify it in the Node Tracer's configuration:
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
const { AzureFunctionsInstrumentation } = require('@azure/functions-opentelemetry-instrumentation');
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
// Azure Functions instrumentation expects HTTP layer to be instrumented
new HttpInstrumentation(),
new AzureFunctionsInstrumentation(),
],
});
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js