# Add this to your existing docker-compose.yml to enable .NET tracing
# 
# Usage:
# 1. Add the otel-init service
# 2. Add environment variables and volumes to your .NET app
# 3. Set OTEL_SERVICE_NAME for each service

services:
  # Init container that provides OpenTelemetry .NET instrumentation
  otel-init:
    build: 
      context: .
      dockerfile: Dockerfile
    volumes:
      - otel-dotnet:/otel-dotnet
    restart: "no"

  # Example: Your .NET app with tracing enabled
  # my-dotnet-app:
  #   image: your-image:tag
  #   depends_on:
  #     otel-init:
  #       condition: service_completed_successfully
  #   environment:
  #     # OpenTelemetry config
  #     - OTEL_SERVICE_NAME=my-dotnet-app
  #     - OTEL_EXPORTER_OTLP_ENDPOINT=http://ophion:8080
  #     - OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
  #     - OTEL_TRACES_EXPORTER=otlp
  #     - OTEL_METRICS_EXPORTER=otlp
  #     - OTEL_LOGS_EXPORTER=otlp
  #     # .NET CLR profiler config
  #     - CORECLR_ENABLE_PROFILING=1
  #     - CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658571}
  #     - CORECLR_PROFILER_PATH=/otel-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
  #     - DOTNET_ADDITIONAL_DEPS=/otel-dotnet/AdditionalDeps
  #     - DOTNET_SHARED_STORE=/otel-dotnet/store
  #     - DOTNET_STARTUP_HOOKS=/otel-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
  #   volumes:
  #     - otel-dotnet:/otel-dotnet:ro

volumes:
  otel-dotnet:
