# Production profile: recommended defaults for most deployments.
# Generated by `click-dog init` (or `click-dog init --wizard`).
# See docs/configuration.md for the full key reference.

clickhouse:
  host: ch.example.com
  port: 9000
  database: system
  username: default
  password: ${CLICKHOUSE_PASSWORD}
  # Connection caps + 30s query timeout: the modest hardening install.sh
  # used to emit unconditionally. Without these the monitor can exhaust
  # pooled connections under sustained load. Override if your cluster
  # can handle more concurrent reads from the monitor.
  max_open_conns: 2
  max_idle_conns: 1
  query_timeout_s: 30

# filters.query_text_mode controls whether raw SQL crosses the export boundary.
# Use normalized_only or none for privacy-sensitive production environments.
# See docs/filtering.md#query-text-export-modes.
exporters:
  otel:
    - collector_address: otel.example.com:4317
      service_name: click-dog-monitor

monitor:
  enabled: true
  min_trace_duration_ms: 1000
  check_interval_s: 30
  max_spans_per_cycle: 1000
  dedup_cache_size: 10000
  # Circuit breaker stops querying ClickHouse after repeated failures so the
  # cluster can recover. See docs/resilience.md.
  circuit_breaker:
    enabled: true
    failure_threshold: 3
    success_threshold: 1
    reset_timeout_s: 60
  # Adaptive backoff layers on top of the breaker: increases the polling
  # interval after consecutive failures, snaps back after sustained success.
  backoff:
    enabled: true
    max_interval_s: 300
    backoff_factor: 2.0

filters:
  query_text_mode: raw # raw | redacted | normalized_only | none
  blacklist_queries:
    - "^SYSTEM"
    - "^INSERT INTO.*\\.inner\\."
  # Drop internal ClickHouse pipeline spans at the SQL level (pushed down as
  # operation_name NOT LIKE '%pattern%'). These are high-volume but
  # low-signal: they represent engine internals, not user queries or
  # their sub-queries. Removing them cuts ingest cost by ~90-99% without
  # losing query-level data.
  blacklist_operations:
    - "MergeTreeSource"
    - "MergeTreeMarksLoader"
    - "MergeTreeIndex"
    - "MergeTreeSequentialSource"
    - "VFSWrite"
    - "WriteBufferFromS3"
    - "ConcurrentJoin"
    - "QueryPipelineEx"

metrics:
  enabled: true
  listen_address: ":9090"
  otlp:
    # Push click-dog's own health metrics over OTLP, reusing exporters.otel[0].
    # Feeds the Datadog "Click-Dog: Health" dashboard. Delete to disable.
    enabled: true

health:
  enabled: true
  listen_address: ":8686"

log_level: info
