Skip to main content

Architecture

dbt-bigquery-monitoring is a dbt package that ingests raw BigQuery metadata from multiple GCP sources and transforms it into business-ready monitoring tables.

Data flow


Layer descriptions

Base layer

Raw data ingestion and standardization. Each model corresponds to one GCP source:

ModelSourceDescription
bigquery_audit_logs_v2Cloud Audit LogsRaw v2 audit log events (jobs, table changes, etc.)
jobs_from_audit_logsExtracts structured job records from audit log events
gcp_billing_export_resource_v1Cloud Billing exportDetailed SKU-level billing records
jobs_with_costIS + Audit logsCentral model — unified job view with cost attribution
storage_with_costINFORMATION_SCHEMATable storage metrics with storage cost
table_and_storage_with_costINFORMATION_SCHEMAPer-table storage with billing model details

Intermediate layer

In project mode, INFORMATION_SCHEMA tables cannot be queried across projects in a single BigQuery job. The intermediate layer materializes results project-by-project using the project_by_project_table custom materialization, then consolidates them into unified tables.

In region mode, this layer is ephemeral — models resolve directly as subqueries.

Datamarts

High-level, business-ready output tables designed for direct BI tool consumption or ad-hoc queries. See Using the package and Monitoring Datamarts for details.


Materialization strategy

LayerRegion modeProject mode
INFORMATION_SCHEMA wrappersephemeralincremental (per project)
Base modelsephemeralephemeral
jobs_with_costincrementalincremental
Datamartstable (configurable)table (configurable)

The output_materialization variable controls the datamart materialization type (see package settings).