# ═══════════════════════════════════════════════════════════ # 🐍 OPHION - Node.js Auto-Instrumentation Example # Demonstrates automatic tracing for Node.js applications # ═══════════════════════════════════════════════════════════ # # Usage: # docker-compose up -d # # This example shows how to instrument ANY Node.js app without # code changes using @opentelemetry/auto-instrumentations-node # ═══════════════════════════════════════════════════════════ version: '3.8' services: nodejs-app: build: context: . dockerfile: Dockerfile ports: - "3001:3000" environment: # ════════════════════════════════════════════════════ # OpenTelemetry Auto-Instrumentation Configuration # ════════════════════════════════════════════════════ # Service identification - OTEL_SERVICE_NAME=nodejs-example-app - OTEL_SERVICE_VERSION=1.0.0 # OTLP Exporter configuration (pointing to Ophion collector) - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 - OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf - OTEL_TRACES_EXPORTER=otlp - OTEL_METRICS_EXPORTER=otlp - OTEL_LOGS_EXPORTER=otlp # Resource attributes - OTEL_RESOURCE_ATTRIBUTES=deployment.environment=development,service.namespace=ophion-examples # Sampling (1.0 = 100% of traces) - OTEL_TRACES_SAMPLER=parentbased_traceidratio - OTEL_TRACES_SAMPLER_ARG=1.0 # Propagation format - OTEL_PROPAGATORS=tracecontext,baggage,b3multi # Enable auto-instrumentation via Node.js loader - NODE_OPTIONS=--require @opentelemetry/auto-instrumentations-node/register networks: - ophion restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"] interval: 10s timeout: 5s retries: 3 networks: ophion: external: true