services:
  otelcol:
    image: otel/opentelemetry-collector-contrib:0.120.0
    container_name: psch-perf-otelcol
    command: ["--config=/etc/otelcol-contrib/config.yaml"]
    volumes:
      - ./otel/collector-config.yaml:/etc/otelcol-contrib/config.yaml

  pg-perf:
    build:
      context: ..
      dockerfile: docker/perf.Dockerfile
    image: psch-perf-pg:latest
    container_name: psch-perf-pg
    depends_on:
      otelcol:
        condition: service_started
    environment:
      OTEL_ENDPOINT: "otelcol:4317"
      OTEL_HEALTH: "http://otelcol:13133"
      RESULTS_DIR: "/results"
    # perf record needs elevated privileges to access hardware counters
    # and to attach to running processes.
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE
    security_opt:
      - seccomp:unconfined
    volumes:
      - ./perf-results:/results
