Monitoring on Databricks is the practice of converting raw operational telemetry into actionable signal about whether a pipeline is correct, fast, and within budget.
Four surfaces are in scope for the Professional exam, and each one answers a different question:
- system tables answer "what happened across the workspace over time"
- the Spark UI and Query Profile answer "why was this single query slow or wrong"
- the REST API and CLI answer "what is the state of this run right now from outside the workspace"
- the Lakeflow Spark Declarative Pipelines event log answers "what did the declarative engine decide and observe on this pipeline update"
Production observability requires all four because no single surface carries every signal:
- The Spark UI does not know the DBU cost.
- System tables do not show shuffle skew.
- The REST API does not show expectation violations.
- The SDP event log does not surface foreign-source query metrics.
A clean monitoring rollout assigns each signal to exactly one surface and writes runbooks that traverse the right one.
This section walks each surface in order, anchored on the production patterns the exam tests:
- pulling cost by job from billing telemetry,
- diagnosing a skewed sort-merge join from the SQL DAG,
- polling a long-running job for SLA tracking,
- reading expectation outcomes from the pipeline event log.
Each surface has its own data model, its own retention envelope, and its own permissions surface, so a credible monitoring design starts by mapping signals to surfaces before any code is written.
The most common production mistake is reading a single surface for a question that belongs to a different one, which is why every example below is anchored on the question it answers, not the table it queries.
System Tables for Resource, Cost, Audit, and Workload Observability
System tables are read-only Delta tables managed by Databricks and exposed under the system catalog in Unity Catalog.
They carry workspace-scoped and account-scoped telemetry that survives cluster termination, run completion, and notebook deletion, so they are the only surface that supports historical analysis past the in-process retention windows of the Spark UI and the pipeline event log.
Each system schema is enabled independently and propagates to every workspace bound to the metastore; an account admin or metastore admin enables a schema once via the SystemSchemas API and grants USE SCHEMA plus SELECT to the relevant principal groups.
Key points
The schemas a Professional-tier engineer is expected to query are:
system.billing.usagefor DBU and dollar consumption per workspace and SKUsystem.billing.list_pricesfor the per-unit price catalog used to compute costsystem.access.auditfor every authenticated action against the workspace and accountsystem.access.table_lineageandsystem.access.column_lineagefor read/write graph capturesystem.compute.clustersandsystem.compute.warehousesfor compute configuration historysystem.compute.node_typesfor the SKU dictionarysystem.lakeflow.jobsandsystem.lakeflow.job_run_timelineandsystem.lakeflow.job_task_run_timelinefor Lakeflow Jobs orchestrationsystem.lakeflow.pipelinesfor Lakeflow SDP definitionssystem.query.historyfor every executed SQL warehouse querysystem.serverless.billing_estimated_usagefor serverless workload cost attribution
Each table is appended in near real time; a typical end-to-end latency from event to row visibility is on the order of minutes, never sub-second, so system tables are not the right surface for live operational dashboards that need second-grained updates. The canonical first query is workload cost attribution by job.
- The
billing.usagetable carries one row per usage record withsku_name,usage_quantityin DBUs,usage_start_time,usage_end_time,workspace_id,cloud,usage_metadata, and a free-formcustom_tagsmap. - The
usage_metadatastruct carries thejob_id,job_run_id,cluster_id,warehouse_id,dlt_pipeline_id, andnotebook_idkeys when the usage record was generated by one of those constructs. - Joining
billing.usageagainstbilling.list_pricesoversku_nameplus the price window gives the dollar cost; joining further againstlakeflow.jobsoverjob_idresolves the job name and definition.
SELECT
j.name AS job_name,
u.usage_metadata.job_id AS job_id,
DATE_TRUNC('day', u.usage_start_time) AS usage_day,
SUM(u.usage_quantity) AS dbus,
SUM(u.usage_quantity * p.pricing.default) AS dollars
FROM system.billing.usage u
JOIN system.billing.list_prices p
ON u.sku_name = p.sku_name
AND u.usage_start_time >= p.price_start_time
AND (u.usage_end_time <= p.price_end_time OR p.price_end_time IS NULL)
LEFT JOIN system.lakeflow.jobs j
ON u.usage_metadata.job_id = j.job_id
AND u.workspace_id = j.workspace_id
WHERE u.usage_start_time >= DATE_SUB(CURRENT_DATE(), 30)
AND u.usage_metadata.job_id IS NOT NULL
GROUP BY j.name, u.usage_metadata.job_id, DATE_TRUNC('day', u.usage_start_time)
ORDER BY dollars DESC;
The lakeflow.jobs table is a slowly changing dimension where each row carries change_time, delete_time, and an account_id/workspace_id/job_id natural key; joining without filtering for the most recent change_time per job produces a row multiplier equal to the number of edits the job has accumulated.
A correctness filter narrows the dimension to the version active during the usage window, typically a QUALIFY ROW_NUMBER() OVER (PARTITION BY job_id ORDER BY change_time DESC) = 1 or a time-bounded match on change_time <= usage_start_time AND (delete_time IS NULL OR delete_time > usage_end_time).
WITH latest_jobs AS (
SELECT * FROM system.lakeflow.jobs
QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, job_id ORDER BY change_time DESC) = 1
)
SELECT lj.name, SUM(u.usage_quantity) AS dbus
FROM system.billing.usage u
JOIN latest_jobs lj
ON lj.job_id = u.usage_metadata.job_id
AND lj.workspace_id = u.workspace_id
WHERE u.usage_start_time >= DATE_SUB(CURRENT_DATE(), 7)
GROUP BY lj.name
ORDER BY dbus DESC;
The lakeflow.job_run_timeline and lakeflow.job_task_run_timeline tables carry one row per run state period (with period_start_time, period_end_time, result_state, termination_code) and per task run respectively. These tables are the right source for SLA tracking, success-rate reporting, and per-task duration percentiles.
The result_state field takes values SUCCEEDED, FAILED, CANCELED, TIMEDOUT, EXCLUDED, MAXIMUM_CONCURRENT_RUNS_REACHED, UPSTREAM_CANCELED, and UPSTREAM_FAILED; termination_code is the granular reason such as USER_CANCELED, JOB_FINISHED, RUN_EXECUTION_ERROR, CLOUD_FAILURE, or INTERNAL_ERROR. A run-success-rate dashboard joins job_run_timeline to latest_jobs and aggregates result_state per job per day.
The access.audit table carries one row per authenticated action with event_time, user_identity, service_name, action_name, request_params, response, audit_level (WORKSPACE_LEVEL or ACCOUNT_LEVEL), and a source_ip_address. Authentication anomalies (failed logins by service_name = 'accounts' and action_name = 'login'), permission changes (service_name = 'unityCatalog' with action_name LIKE '%Grant%'), and Delta Sharing reads (action_name = 'deltaSharingQueriedTable') are all evidence that lives only in access.audit.
A common production query is the seven-day rolling list of principals who escalated privileges on a sensitive catalog.
SELECT event_time, user_identity.email AS actor, action_name,
request_params.securable_type, request_params.securable_full_name,
request_params.changes
FROM system.access.audit
WHERE service_name = 'unityCatalog'
AND action_name IN ('updatePermissions','setPermissions')
AND request_params.securable_full_name LIKE 'finance.%'
AND event_time >= DATE_SUB(CURRENT_TIMESTAMP(), 7)
ORDER BY event_time DESC;
The query.history table carries one row per Databricks SQL warehouse query (note: it does not cover all-purpose cluster queries, which appear in the Spark UI and driver logs only). Fields include statement_id, warehouse_id, executed_by, statement_text, start_time, end_time, total_duration_ms, compilation_time_ms, execution_time_ms, read_bytes, read_files, read_partitions, read_rows, written_bytes, written_rows, produced_rows, spilled_local_bytes, result_cache_hit, and execution_status.
The combination of query.history plus compute.warehouses is the standard surface for warehouse utilization tuning, queue-time analysis, and serverless cost attribution at the SQL workload level.
SELECT executed_by, COUNT(*) AS queries,
AVG(total_duration_ms) AS avg_ms,
PERCENTILE(total_duration_ms, 0.95) AS p95_ms,
SUM(spilled_local_bytes) / POWER(1024, 3) AS spill_gb
FROM system.query.history
WHERE start_time >= DATE_SUB(CURRENT_TIMESTAMP(), 1)
AND warehouse_id = 'abc123'
GROUP BY executed_by
ORDER BY p95_ms DESC;
π Limit:
system.billing.usageretains usage records for 365 days. Older data must be copied to an archive Delta table maintained by the data platform team if the organization requires multi-year cost analysis.
π‘ Exam Trap: Joining
system.billing.usageagainstsystem.lakeflow.jobswithout de-duplicating the SCD-typed jobs dimension multiplies cost rows by the count of edits per job. The fix is a window function (QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, job_id ORDER BY change_time DESC) = 1) or a time-bounded match usingchange_timeanddelete_time. Producing inflated cost dashboards from this bug is a common production error.
β οΈ Anti-Pattern: Treating
system.access.auditas a live security feed by querying it every few seconds. The pipeline that populates this table batches events with a latency on the order of minutes, so sub-minute polling burns DBUs without adding signal. Use audit log delivery to cloud storage if real-time SIEM forwarding is required, and reserveaccess.auditfor forensic reads.
π― Scenario: A nightly orchestration runs 200 Lakeflow Jobs across two workspaces. Finance reports that aggregate compute spend has doubled in the last billing window without an obvious cause. The triage path queries
system.billing.usagegrouped byusage_metadata.job_idplussku_name, joins to the de-duplicatedsystem.lakeflow.jobsdimension for job names, and ranks by week-over-week dollar delta. The top mover is a single job whose dev branch was merged withexisting_cluster_idpinned to an all-purpose cluster instead of a job cluster, which moved its SKU fromSTANDARD_JOBS_COMPUTEtoSTANDARD_ALL_PURPOSE_COMPUTEand roughly doubled the per-DBU price. Withoutsystem.billing.usage, this signal is invisible: the Spark UI shows the run succeeded, the REST API shows the run state, and neither carries the SKU.
Cross-schema joins and the canonical observability layer
Production teams typically materialize a layer of Delta views on top of system tables to hide the SCD-typed joins, the price-window match, and the usage_metadata struct unpacking.
A view such as obs.daily_job_cost materializes the cost-by-job query above and is the only surface user dashboards touch.
This gives the platform team:
- one place to fix the join bug,
- one place to back-pressure expensive queries away from raw system tables,
- one place to apply row filters that hide cost data across business units.
The same pattern applies for:
obs.run_health(joiningjob_run_timelinepluslatest_jobs),obs.warehouse_utilization(joiningquery.historypluscompute.warehouses).
The Professional exam expects the practitioner to know the names of the source tables, the join keys, and the SCD pitfall, not the surface name a particular team chose.
Query Profile UI and Spark UI for Workload Monitoring
The Query Profile UI and the Spark UI are the two execution-evidence surfaces. They overlap in coverage but answer slightly different questions:
- The Query Profile is the SQL-warehouse-flavoured view of a single statement's physical plan and rewinds the execution into a node-by-node tree of operators with
rows_read,bytes_read,bytes_pruned,duration_ms,peak_memory_bytes, and a categoricalmost_expensive_node. - The Spark UI is the lower-level per-stage and per-task view that covers any Spark workload (job clusters, all-purpose clusters, structured streaming, Lakeflow SDP) and shows the Application timeline, the SQL DAG, the Stage detail with shuffle read/write per partition, the Executor table, and the Storage tab.
How it works
The Query Profile is reached from the History page of the SQL editor or the warehouse's Monitoring tab and renders a top-down operator tree (Scan -> Filter -> Project -> HashAggregate -> Shuffle -> ResultStage). Each operator carries the metrics needed to diagnose the four canonical SQL bottlenecks: bad data skipping, inefficient join type, unbalanced shuffle, and bad caching.
Bad data skipping shows as a Scan node where files_pruned is small relative to files_read even though the query predicate looks selective; the remediation is verifying file statistics in the Delta log (DESCRIBE DETAIL plus DESCRIBE HISTORY) and adding Liquid Clustering keys or rebuilding the Z-ORDER.
Inefficient join types show as a sort-merge join node where one input is small enough that a broadcast join would have eliminated the shuffle; the remediation is verifying spark.sql.autoBroadcastJoinThreshold (defaults to 10 MB) and rewriting with a BROADCAST hint when AQE has not auto-converted.
Unbalanced shuffle shows as a Shuffle node where the per-partition size histogram is skewed (one partition holds 70 percent of the bytes); the remediation is enabling AQE skew handling (spark.sql.adaptive.skewJoin.enabled = true) and salting the join key when AQE cannot detect the skew at runtime.
Bad caching shows as a Scan node that re-reads bytes already in the disk cache; the remediation is increasing the SQL warehouse class so the cache has room to hold the working set.
The Spark UI exposes five tabs by default:
- Jobs
- Stages
- Storage
- Environment
- Executors
Plus a SQL/DataFrame tab when a SQL or DataFrame query has run and a Structured Streaming tab when a streaming query is active.
The Jobs page lists every Spark job with its description (taken from the call site), submission time, duration, success state, and the stages it spawned. Clicking into a job opens the DAG visualization (the lineage of RDDs and operators) plus the per-stage timeline.
The Stages tab is where most diagnosis happens: a single stage carries the Summary Metrics for N Completed Tasks histogram with Duration, GC Time, Spill (Memory), Spill (Disk), Shuffle Read Size / Records, Shuffle Write Size / Records, and Peak Execution Memory per task.
Skewed stages show as a max/median ratio over 4x in Duration or Shuffle Read Size.
Spill-heavy stages show non-zero values in Spill (Disk).
GC-pressured stages show GC Time over roughly 10 percent of Duration.
# Submit a Spark job that AQE can adapt at runtime
spark.conf.set("spark.sql.adaptive.enabled", True)
spark.conf.set("spark.sql.adaptive.coalescePartitions.enabled", True)
spark.conf.set("spark.sql.adaptive.skewJoin.enabled", True)
spark.conf.set("spark.sql.adaptive.advisoryPartitionSizeInBytes", 64 * 1024 * 1024)
spark.conf.set("spark.sql.shuffle.partitions", 800)
# Force a broadcast on a known-small dimension to bypass the AQE threshold
from pyspark.sql.functions import broadcast
fact = spark.table("sales.fact_order")
dim = spark.table("sales.dim_currency")
joined = fact.join(broadcast(dim), "currency_code")
joined.write.mode("overwrite").saveAsTable("sales.fact_order_currency_priced")
The Storage tab lists every RDD or DataFrame that has been cached via cache(), persist(), or the SQL CACHE TABLE command.
Each row carries the storage level (MEMORY_ONLY, MEMORY_AND_DISK, DISK_ONLY, MEMORY_AND_DISK_SER), the fraction of the dataset in memory versus on disk, and the total size.
The Executors tab carries per-executor Active Tasks, Failed Tasks, Completed Tasks, Total Tasks, Task Time, Input, Shuffle Read, Shuffle Write, Storage Memory, and Logs.
A common debugging path on a long-running job is:
- filtering the Executors table for high
Failed Taskscount - opening the per-executor logs
- grep-ing the stderr for
OutOfMemoryErrororContainer killed by YARN for exceeding memory limits(or the Kubernetes equivalent on serverless compute)
The SQL/DataFrame tab carries the logical plan, the optimized plan, the physical plan, and the runtime DAG with per-node numFiles, filesSize, pruningTime, scanTime, numOutputRows, and the WholeStageCodegen group boundaries.
The structured streaming tab carries per-query Input Rate, Process Rate, Batch Duration, Operation Duration (state store, file source, sink), and the Aggregated Number of Total State Rows and Aggregated Number of Updated State Rows.
A streaming query whose process rate is consistently lower than its input rate is back-pressuring and is on a path to falling behind the source; this is the surface to consult.
# Inspect the streaming progress object for the same metrics surfaced in the UI
query = (
spark.readStream.format("delta").table("bronze.orders")
.writeStream
.option("checkpointLocation", "/Volumes/cat/sch/ck/silver_orders")
.trigger(processingTime="30 seconds")
.toTable("silver.orders")
)
import json, time
while query.isActive:
progress = query.lastProgress
if progress is not None:
print(json.dumps({
"batchId": progress["batchId"],
"inputRowsPerSecond": progress["inputRowsPerSecond"],
"processedRowsPerSecond": progress["processedRowsPerSecond"],
"durationMs": progress["durationMs"],
"stateOperators": [
{"numRowsTotal": o["numRowsTotal"], "numRowsUpdated": o["numRowsUpdated"]}
for o in progress.get("stateOperators", [])
],
}, indent=2))
time.sleep(30)
Spark UI Decision Tree: Where to Click for Each Symptom
π‘ Exam Trap: The Query Profile shows
files_prunedandfiles_readat the Scan node, notpartitions_pruned. A partition-pruning question that asks how to verify pruning happened on a Delta table answers with the Scan node metrics, not withEXPLAIN EXTENDED. TheEXPLAINoutput shows the predicate pushdown plan; the Query Profile shows the runtime evidence.
π‘ Exam Trap:
spark.sql.files.maxPartitionBytescontrols the input split size for source file reading (default 128 MB).spark.sql.adaptive.advisoryPartitionSizeInBytescontrols the AQE shuffle target after coalesce (default 64 MB).spark.sql.shuffle.partitionscontrols the static number of shuffle partitions before AQE coalesces them (default 200). Confusing these three knobs is the textbook exam trap; each knob acts at a different stage of the physical plan.
β οΈ Anti-Pattern: Reading the SQL DAG and then editing the query to add a
REPARTITIONhint without checking whether AQE coalesce is enabled. With AQE enabled, a staticREPARTITION(N)is overridden at runtime and produces no effect on the shuffle partition count downstream. The correct levers are the AQE configs and theREBALANCEhint, which AQE respects.
π― Scenario: A nightly Silver-layer aggregation runs for two hours, but the Query Profile shows the bottom 90 percent of stages complete in five minutes. The top of the operator tree is a HashAggregate fed by a Shuffle whose per-partition size histogram shows one partition at 12 GB and the median at 200 MB. The engineer toggles
spark.sql.adaptive.skewJoin.enabled = true, re-runs, and the runtime drops to 35 minutes because AQE splits the 12 GB partition into 25 smaller partitions at runtime. Without the per-partition histogram in the Stages tab, this diagnosis is invisible.
Databricks REST API and CLI for Job and Pipeline Monitoring
The REST API and the Databricks CLI are the programmatic surface for run state retrieval, pipeline status polling, and on-demand triggers.
They are the right surface for any external orchestrator (an upstream scheduler, an on-call automation, a Slack bot, a CI/CD smoke test) that needs to read or react to workspace state without opening the UI.
The CLI is a thin wrapper over the REST API plus a unified configuration profile, so the two share endpoints, request shapes, and response shapes; the choice is operational, not semantic.
The Jobs REST API is mounted under /api/2.2/jobs; key endpoints are:
GET /api/2.2/jobs/list(paginated list of job definitions)GET /api/2.2/jobs/get(definition of a single job by id)GET /api/2.2/jobs/runs/list(paginated list of historical runs by job id)GET /api/2.2/jobs/runs/get(a single run including its task tree)POST /api/2.2/jobs/run-now(one-shot trigger)POST /api/2.2/jobs/runs/cancel(cancel an in-flight run)
The list endpoints page via a next_page_token; the client must follow tokens to retrieve a full result set.
Run states are exposed via the state.life_cycle_state (PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR) and state.result_state (SUCCESS, FAILED, TIMEDOUT, CANCELED, MAXIMUM_CONCURRENT_RUNS_REACHED, EXCLUDED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED).
The state.state_message carries a human-readable termination reason and is the right field to surface in alerts.
# Retrieve the last 25 runs of job 12345 with full task detail
databricks jobs list-runs \
--job-id 12345 \
--limit 25 \
--expand-tasks \
--output json \
| jq '.runs[] | {
run_id, run_name, state: .state.life_cycle_state,
result: .state.result_state,
started: .start_time, ended: .end_time,
cause: .state.state_message
}'
# The same call against the REST API directly, with paging
import os, requests
DBR_HOST = os.environ["DATABRICKS_HOST"]
DBR_TOKEN = os.environ["DATABRICKS_TOKEN"]
def runs_by_job(job_id):
params = {"job_id": job_id, "expand_tasks": "true", "limit": 25}
while True:
r = requests.get(
f"{DBR_HOST}/api/2.2/jobs/runs/list",
headers={"Authorization": f"Bearer {DBR_TOKEN}"},
params=params,
timeout=30,
)
r.raise_for_status()
body = r.json()
for run in body.get("runs", []):
yield run
if not body.get("has_more"):
return
params["page_token"] = body["next_page_token"]
The Pipelines REST API is mounted under /api/2.0/pipelines; key endpoints are:
GET /api/2.0/pipelines(list with filter expressions likestate IN ('FAILED','RUNNING'))GET /api/2.0/pipelines/{pipeline_id}(full definition plus latest update id and state)GET /api/2.0/pipelines/{pipeline_id}/updates(paginated list of pipeline updates)GET /api/2.0/pipelines/{pipeline_id}/updates/{update_id}(single update withcreation_time,state,cause,full_refresh,refresh_selection,validate_only)POST /api/2.0/pipelines/{pipeline_id}/updates(trigger an update)POST /api/2.0/pipelines/{pipeline_id}/stop(graceful stop)
Pipeline update states cycle through CREATED, QUEUED, WAITING_FOR_RESOURCES, INITIALIZING, RESETTING, SETTING_UP_TABLES, RUNNING, STOPPING, COMPLETED, FAILED, CANCELED; the alerting condition for a stuck pipeline is a RUNNING state whose creation_time is older than a runbook-defined SLA threshold.
# Trigger a full-refresh update of a Lakeflow SDP pipeline and capture the update id
databricks pipelines start-update \
--pipeline-id abcd1234 \
--full-refresh \
--output json \
| jq -r '.update_id'
# Poll the pipeline state until the update reaches a terminal state
PIPELINE=abcd1234
UPDATE=$(databricks pipelines list-updates --pipeline-id $PIPELINE --max-results 1 \
| jq -r '.updates[0].update_id')
while true; do
STATE=$(databricks pipelines get-update \
--pipeline-id $PIPELINE --update-id $UPDATE \
| jq -r '.update.state')
case "$STATE" in
COMPLETED|FAILED|CANCELED) echo "Final state: $STATE"; break ;;
*) echo "State: $STATE"; sleep 30 ;;
esac
done
The CLI's --profile flag selects one of several ~/.databrickscfg connection profiles, which is the right pattern when an automation talks to dev, staging, and prod workspaces from the same runner.
Credentials should be supplied through OAuth machine-to-machine for service principals (auth_type = oauth-m2m plus a client id and a secret in the secret store), not through personal access tokens.
Tokens leak by accident, rotate by hand, and tie automations to a human identity that can leave the organization.
A common production pattern is the on-call alert that fires when a job has been running for longer than its 90th percentile historical duration. This pattern is implementable in two ways:
- Poll the REST API from a separate scheduled job (cheap, fully under the team's control, requires writing the polling code).
- Query
system.lakeflow.job_run_timelinefor in-flight runs whoseperiod_start_timeis older than a threshold (cheaper still, no polling, latency of minutes from system tables).
The REST polling path is the right choice when seconds matter. The system tables path is the right choice for SLA dashboards.
π Limit: The Databricks Jobs API returns at most 25 runs per page by default, with a maximum of 25 per page. A full year of run history for a job that runs every 15 minutes is 35,040 rows, requiring over 1,400 paged calls. The right pattern for backfilling history into a Delta table is
system.lakeflow.job_run_timelinerather than API pagination.
π‘ Exam Trap: The Jobs API returns
state.life_cycle_stateandstate.result_stateas separate fields. A run inlife_cycle_state = TERMINATEDmay haveresult_stateofSUCCESS,FAILED,CANCELED, orTIMEDOUT. Filtering only bylife_cycle_state != 'TERMINATED'to find in-flight runs is correct; filtering byresult_state != 'SUCCESS'to find failures also catches every in-flight run that has noresult_stateyet, which can cause alerts to fire on live runs.
β οΈ Anti-Pattern: Polling
runs/listevery five seconds for a pipeline that runs hourly. The right cadence is matched to the SLA, and the right surface is a webhook-driven notification destination (covered in the Alerting section below) rather than aggressive polling. Aggressive polling consumes API capacity and burns budget on the polling cluster.
π― Scenario: A nightly multi-task job orchestrates 12 sequential tasks, and operations needs a Slack message when task 8 starts (because task 8 owns an SLA tied to downstream consumers). The implementation uses the Lakeflow Jobs notification destination feature on task 8's
notifications.on_startsetting, not the REST API. The REST path is the right choice only when the trigger comes from outside the workspace, or when the message recipient cannot accept a Databricks notification destination payload.
Lakeflow Spark Declarative Pipelines Event Logs
Every Lakeflow Spark Declarative Pipeline emits a structured event log to a Delta table that the pipeline manages on the user's behalf.
The event log is the canonical source of truth for the pipeline's decisions: which datasets it updated, how many rows entered and left each flow, which expectations passed and failed, what backfills ran, and which steps the planner picked.
Querying the event log is the way to convert a black-box pipeline run into observable signal that can be alerted on, joined to billing data, and embedded in dashboards. The event log is accessible in three ways.
- The recommended path is the
event_log()table-valued function:SELECT * FROM event_log(<pipeline_id>)returns rows for the specified pipeline. - A pipeline can also publish its event log as a regular Unity Catalog table by setting
event_log = { "catalog": "obs", "schema": "pipelines", "name": "sales_silver_event_log" }in the pipeline settings, which makes the log queryable like any other Delta table and supports row filters, grants, and downstream Lakeflow Jobs. - The legacy path is reading the event log directly from the pipeline's storage location as a Delta table, which is still supported for pipelines that predate the publish-to-UC option.
Every event log row carries id, sequence, origin, timestamp, message, level (INFO, WARN, ERROR, METRICS), event_type, maturity_level, error, and details.
The details column is a struct keyed by event_type:
flow_progressrows carrynum_output_rows,num_upserted_rows,num_deleted_rows,backlog_bytes, andmetrics.data_qualityrows carrydatasetandexpectationswith one entry per expectation showingname,dataset,passed_records,failed_records,dropped_records.flow_definitionrows carry the parsed dataset graph.cluster_resourcesrows carry the per-update compute provisioning.update_progressrows carry the lifecycle transitions.planning_informationrows carry the planner's flow ordering decisions.
-- Materialize the most recent expectation outcomes per dataset per update
SELECT
origin.update_id,
details.data_quality.dataset AS dataset,
expect.name AS expectation,
expect.passed_records,
expect.failed_records,
expect.dropped_records,
timestamp AS observed_at
FROM event_log('abcd-1234-pipeline-id')
LATERAL VIEW EXPLODE(details.data_quality.expectations) AS expect
WHERE event_type = 'flow_progress'
AND timestamp >= DATE_SUB(CURRENT_TIMESTAMP(), 1);
The flow_progress event type is the primary metric source:
- one row per flow per microbatch in continuous mode,
- one row per flow per refresh in triggered mode.
The metrics.num_output_rows field carries the count of rows the flow wrote; the metrics.backlog_bytes field carries the unprocessed bytes in the source for streaming flows and is the canonical signal for back-pressure detection.
A streaming flow whose backlog_bytes grows monotonically across microbatches is falling behind the source and warrants either a larger cluster or a higher trigger interval.
The metrics.num_upserted_rows and metrics.num_deleted_rows carry the CDC volume for APPLY CHANGES INTO flows.
-- Find streaming flows whose backlog has grown over the last hour
WITH backlog AS (
SELECT
origin.flow_name,
timestamp,
details.flow_progress.metrics.backlog_bytes AS backlog_bytes,
ROW_NUMBER() OVER (PARTITION BY origin.flow_name ORDER BY timestamp DESC) AS rn
FROM event_log('abcd-1234-pipeline-id')
WHERE event_type = 'flow_progress'
AND timestamp >= DATE_SUB(CURRENT_TIMESTAMP(), 1)
)
SELECT
l.flow_name,
l.backlog_bytes AS latest_backlog,
e.backlog_bytes AS earliest_backlog,
l.backlog_bytes - e.backlog_bytes AS delta_bytes
FROM backlog l
JOIN backlog e
ON l.flow_name = e.flow_name AND e.rn = (SELECT MAX(rn) FROM backlog WHERE flow_name = l.flow_name)
WHERE l.rn = 1
AND l.backlog_bytes - e.backlog_bytes > 1024 * 1024 * 1024;
The update_progress event type records every state transition of a pipeline update with state taking values INITIALIZING, SETTING_UP_TABLES, STARTING, RUNNING, STOPPING, COMPLETED, FAILED, CANCELED.
Joining update_progress to the cost view that derives from system.billing.usage filtered on usage_metadata.dlt_pipeline_id produces a per-update cost report; the same join surfaces the cost of full-refresh updates versus incremental ones, which is operational evidence the SDP UI does not surface directly.
The planning_information event type records the planner's chosen execution order.
SDP plans each update by walking the dataset graph, ordering flows by dependency, and choosing which flows to evaluate in parallel.
The planning rows expose source_datasets, target_dataset, flow_type (COMPLETE, APPEND, CHANGE, MATERIALIZED_VIEW, STREAMING_TABLE), and selected (whether the user's refresh selection chose this flow).
When a partial refresh produces unexpected output, the planning_information row is the surface that explains why.
Event Flow: From a Pipeline Update to a Triaged Alert
π Limit: The event log emits one
flow_progressrow per flow per microbatch in continuous pipelines, which can reach hundreds of thousands of rows per day for a wide pipeline. Plan for partition pruning ontimestampandorigin.flow_namewhen querying long windows; publishing the event log to a Unity Catalog table allows Liquid Clustering on those keys.
π‘ Exam Trap: Reading the SDP UI's "data quality" tab and assuming the percentages reflect lifetime expectation outcomes. The UI shows per-update metrics; lifetime trends require querying the event log directly. A question that asks for the source of historical expectation outcomes answers with the event log, not the UI.
β οΈ Anti-Pattern: Filtering the event log on
level = 'ERROR'only when triaging a failed update. Many failure modes (a flow that processed zero rows when it should have processed thousands, an expectation that failed silently withON VIOLATION DROP ROW) emit atINFOlevel. The correct triage filter is onevent_typeplusupdate_id, not onlevel.
π― Scenario: A pipeline that ingests orders produced a Silver table with one tenth of the expected row count overnight. The on-call engineer queries
event_log(<id>)for the most recent update, filtersevent_type = 'data_quality', and finds an expectationorders_have_amountwith 9 milliondropped_recordsagainst 10 millionpassed_records, dropping every row where the amount column is null. The defect is upstream: a Bronze ingestion that started populating the amount under a new column name. Without the event log row, the engineer would have to walk Auto Loader rescued data manually; the event log surfaces the answer in one query.
