A sample nodejs
web server app, with distributed tracing configured
and instrumented logging with winston
The app serves http://localhost:8080/. Returns "hello world".
_This app can also serve as a backend for a this python app, to form a richer distributed tracing example.
npm install
To start the app without instrumentation
node app.js
To start the app with instrumentation
node --require './tracing.js' app.js
To start the app with instrumentation exported to an otlp cloud service, ConsoleSpanExporter
in tracing.js should be replaced
with an otlp exporter. See tracing-otlp.js
node --require './tracing-otlp.js' app.js
Make sure to start your otlp endpoint. See here for a sample setup of the grafana cloud agent as your otlp endpoint for sending your metrics to tempo.
To make the logged output ready to be consumed by log shippers, logged output should be in
JSON-line formatted. This requires removing format
from winston.transports.Console
in logger.js.