Install the OpenTelemetry packages
Use npm to add the OpenTelemetry SDK and the OTLP exporter to your application’s dependencies:@opentelemetry/auto-instrumentations-node package will automatically instrument most applications and libraries. Check out the package’s README for a list of libraries and frameworks that it instruments. You can find additional instrumentations for libraries and frameworks in the OpenTelemetry Registry.
Configure OpenTelemetry in your application
Add thisopentelemetry.cjs file to your application with the OpenTelemetry exporter and AppSignal configuration.
Make sure to update the values below with your AppSignal application name, environment and push API key, and to replace the exporter endpoint with the address of your AppSignal collector if needed.
Start your application with OpenTelemetry
To run your application with OpenTelemetry, you need to use the--require flag to load the opentelemetry.cjs file before starting your application:
package.json file to add --require to the command that starts your app.
--require flag with tools such as ts-node and nodemon.
When using a wrapper CLI, such as nest start or fastify start, to start your application, use the NODE_OPTIONS environment variable to pass the flag to the Node.js runtime: