# ═══════════════════════════════════════════════════════════ # 🐍 OPHION - Java Auto-Instrumentation Example # Demonstrates automatic tracing for Java applications # ═══════════════════════════════════════════════════════════ # # Usage: # docker-compose up -d # # This example shows how to instrument ANY Java app without # code changes using the OpenTelemetry Java Agent # ═══════════════════════════════════════════════════════════ version: '3.8' services: java-app: build: context: . dockerfile: Dockerfile ports: - "8081:8080" environment: # ════════════════════════════════════════════════════ # OpenTelemetry Auto-Instrumentation Configuration # ════════════════════════════════════════════════════ # Service identification - OTEL_SERVICE_NAME=java-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 # Java Agent path (set in Dockerfile JAVA_TOOL_OPTIONS) - JAVA_TOOL_OPTIONS=-javaagent:/opt/opentelemetry-javaagent.jar networks: - ophion restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"] interval: 10s timeout: 5s retries: 3 networks: ophion: external: true