- Documentation
- Learning Hub
- Course Database Observability
- Module 2 of 4 Database Observability
How Database Observability works
Slide 3 of 6
Architecture
How data flows
Database Observability uses Grafana Alloy to collect two types of telemetry from your databases:
Collection sources
The data comes from built-in database statistics, not from intercepting queries:
- PostgreSQL uses
pg_stat_statementsfor aggregate query statistics andpg_stat_activityfor active session information. Thepg_stat_statementsextension must be installed and enabled. - MySQL uses
Performance Schema, which is enabled by default in MySQL 8.0+. Query samples are captured from running queries in the performance schema tables.
What Grafana Alloy does
Grafana Alloy runs alongside your database and handles collection:
- Database exporters scrape aggregate metrics from
pg_stat_statementsorPerformance Schemaand forward them to Grafana Cloud Mimir. - Database Observability components query your database for detailed information (query samples, explain plans, schema details) and forward structured logs to Grafana Cloud Loki.
- Purpose-built dashboards in Grafana Cloud correlate these metrics and logs into a unified view of query performance.
Explain plans run
EXPLAIN(notEXPLAIN ANALYZE) on sampled queries, so they estimate costs using cached statistics without actually executing the query.