- Node.js version 12 or newer
- An app to add OpenTelemetry to
To install OpenTelemetry, we recommend LightStep's handy OTel-Launcher, which simplifies the process.
For this tutorial, we’re going to make a very, very simple application: an express service that responds to
http://localhost:9000/hello with "Hello World". It’s as basic as it is original!
First, make a directory to contain your project, and install express:
Once we have that, let’s get to coding. Make a file called
server.js and serve up some hello world:
Boot up server by
and check that it works by visiting
Installing the OpenTelemetry Launcher package will also install OpenTelemetry, plus all currently available instrumentation.
Create a file called
server_init.js. This will serve as your new entry point. You can copy and paste the below code.
- Remember to allow incoming requests to port 55681 of machine where SigNoz backend is hosted
We have included a sample Express application with
README.md at https://github.com/SigNoz/sample-nodejs-app.
Feel free to use this repo to test out OpenTelemetry instrumentation and how to send telemetry data to SigNoz.
Set an environment variable to run the OpenTelemetry launcher in debug mode, where it logs details about the configuration and emitted spans:
The output may be very verbose with some benign errors. Early in the console output, look for logs about the configuration. Next, look for lines like the ones below, which are emitted when spans are emitted to SigNoz.
Running short applications (Lambda/Serverless/etc) If your application exits quickly after startup, you may need to explicitly shutdown the tracer to ensure that all spans are flushed: