# ═══════════════════════════════════════════════════════════ # 🐍 OPHION - Python Auto-Instrumentation Example # Demonstrates automatic tracing for Python applications # ═══════════════════════════════════════════════════════════ # # Usage: # docker-compose up -d # # This example shows how to instrument ANY Python app without # code changes using opentelemetry-instrument command # ═══════════════════════════════════════════════════════════ version: '3.8' services: python-app: build: context: . dockerfile: Dockerfile ports: - "5001:5000" environment: # ════════════════════════════════════════════════════ # OpenTelemetry Auto-Instrumentation Configuration # ════════════════════════════════════════════════════ # Service identification - OTEL_SERVICE_NAME=python-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 # Python-specific: auto-detect instrumentations - OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true networks: - ophion restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:5000/health"] interval: 10s timeout: 5s retries: 3 networks: ophion: external: true