basiradocs
Agent

Collector Reference

All data collectors, their intervals, and what they collect.

The Basira agent runs collectors that periodically query your database for telemetry. Each collector targets a specific system view or data source.

Interval Types

Collectors have two interval types:

  • Base-rate — uses the configurable poll_interval (default 10s). The API can adjust this dynamically via heartbeat responses.
  • Fixed — runs at a hardcoded interval regardless of poll_interval.

PostgreSQL Collectors

CollectorIntervalTypeData Collected
pg_stat_statementspoll_intervalBase-rateQuery performance stats: calls, execution time, rows, block I/O
pg_stat_user_tablespoll_intervalBase-rateTable stats: row counts, seq/index scans, dead tuples, vacuum times
pg_stat_user_indexespoll_intervalBase-rateIndex stats: scans, tuples read/fetched, size
explain_planspoll_intervalBase-rateSampled EXPLAIN ANALYZE plans for active queries
pg_stat_activity5sFixedActive queries, session state, wait events, blocking info
pg_locks5sFixedLock type, mode, granted status, blocking relationships
pg_wait_events10sFixedWait event distribution and frequency
pg_stat_replication10sFixedReplica lag, slot status, streaming state
pg_stat_wal30sFixedWAL generation rate, bytes written (PostgreSQL 14+)
pg_stat_io30sFixedI/O operations by backend type and object (PostgreSQL 16+)
auto_explain30sFixedSlow query plans from PostgreSQL log files
pg_stat_bgwriter60sFixedCheckpoint frequency, buffer writes, backend flushes
pg_settings5mFixedPostgreSQL configuration parameters

Version Requirements

  • PostgreSQL 14+pg_stat_wal collector activates
  • PostgreSQL 16+pg_stat_io collector activates
  • PostgreSQL 17+ — checkpoint stats from pg_stat_checkpointer

Collectors for unavailable views are silently skipped.

ClickHouse Collectors

CollectorIntervalTypeData Collected
ch_query_logpoll_intervalBase-rateHistorical query stats from system.query_log
ch_processes5sFixedCurrently running queries with resource usage
ch_merges10sFixedActive merge operations from system.merges
ch_replication10sFixedReplication status and replica lag
ch_parts30sFixedData parts metadata (active parts, sizes)
ch_mutations30sFixedMutation operations and progress
ch_server_metrics30sFixedServer-level metrics: memory, disk, connections
ch_settings5mFixedClickHouse configuration parameters

Version Requirements

  • ClickHouse 21.8+ — required for normalized_query_hash used by ch_query_log

Enabling and Disabling Collectors

By default, all collectors for your database engine are enabled. To run only specific collectors, set enabled_collectors in your agent config:

databases:
  - name: primary-pg
    dsn: postgres://basira_monitor:pass@host:5432/db
    enabled_collectors:
      - pg_stat_statements
      - pg_stat_activity
      - pg_locks

The API can also disable collectors dynamically — for example, turning off explain_plans or replication collectors. This happens automatically via the heartbeat response, controlled by the collect_explain_plans and collect_replication settings on each database instance.

Dynamic Interval Adjustment

The API can adjust the poll_interval for base-rate collectors via heartbeat responses. When the API sends a new poll_interval_seconds, all base-rate collectors update their interval without an agent restart.

On this page