services:
  grafana-lgtm:
    image: grafana/otel-lgtm:latest
    container_name: hindsight-monitoring
    ports:
      # Grafana UI
      - "3000:3000"
      # OTLP gRPC (traces)
      - "4317:4317"
      # OTLP HTTP (traces)
      - "4318:4318"
    environment:
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
      - GF_AUTH_DISABLE_LOGIN_FORM=true
    volumes:
      # Mount Prometheus config for scraping Hindsight API metrics (override LGTM default)
      - ./prometheus.yml:/otel-lgtm/prometheus.yaml:ro
      # Mount Hindsight dashboards to LGTM directory (where default dashboards are)
      - ../../../monitoring/grafana/dashboards/hindsight-operations.json:/otel-lgtm/hindsight-operations.json:ro
      - ../../../monitoring/grafana/dashboards/hindsight-llm.json:/otel-lgtm/hindsight-llm.json:ro
      - ../../../monitoring/grafana/dashboards/hindsight-api-service.json:/otel-lgtm/hindsight-api-service.json:ro
      # Mount custom dashboard provisioning config that includes Hindsight dashboards
      - ./grafana-dashboards.yaml:/otel-lgtm/grafana/conf/provisioning/dashboards/grafana-dashboards.yaml:ro
    restart: unless-stopped
    networks:
      - hindsight
    extra_hosts:
      # Allow container to reach host services (Hindsight API on localhost:8888)
      - "host.docker.internal:host-gateway"

networks:
  hindsight:
    name: hindsight-network
    external: true
