Skip to content

uishon/nodejs-tracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodejs tracing

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.

Setup

npm install

Usage

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.

Log Shipping

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.

References

  1. Sample nodejs app with distributed tracing here.
  2. Using winston instrumented version here.
  3. Exporting traces to an otlp backend service here.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published