Skip to content

Node.js application instrumented with OpenTelemetry for Observability

Notifications You must be signed in to change notification settings

tarsojabbes/observability-nodejs

Repository files navigation

NodeJS Observability with OpenTelemetry

Testing purpose application on how to instrumentate NodeJS services for Observability using OpenTelemetry SDK

Disclaimer: Docker, NodeJS and TypeScript must be installed!

How to Run

  1. Set up the environmental variables
export OTEL_SERVICE_NAME="observe-nodejs"
export OTEL_TRACES_EXPORTER="jaeger"
export OTEL_METRICS_EXPORTER="prometheus"
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="http://localhost:9090/"
  1. Install the project dependencies
npm i
  1. Set up the Jaeger service
docker run --rm \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  -p 9411:9411 \
  jaegertracing/all-in-one:latest
  1. Set up the Prometheus service
docker run --rm -v ${PWD}/prometheus.yml:/prometheus/prometheus.yml -p 9090:9090 prom/prometheus --enable-feature=otlp-write-receive
  1. Run the application
npx ts-node --require ./instrumentation.ts app.ts

After that, the app will be exposed on http://localhost:8080, traces will be available at http://localhost:16686 through Jaeger, and metrics can be found at http://localhost:9090 through Prometheus.

About

Node.js application instrumented with OpenTelemetry for Observability

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published