Enterprise Grafana Cloud
Last reviewed: June 11, 2026

Databricks alerting

The Databricks data source supports Grafana alerting. You can create alert rules from Databricks SQL queries to monitor your data and notify your team when conditions are met. For an overview of alerting, refer to Grafana Alerting.

Supported authentication methods for alerting

Alert rules run on a schedule in the background, without a logged-in user present. Authentication methods that depend on an individual user’s identity can’t run alert rules.

Authentication methodSupports alertingReason
Personal Access TokenYesUses a static token that doesn’t require a user context.
OAuth M2MYesAuthenticates as a service principal, so no user context is required.
Azure Entra ID M2MYesAuthenticates as a service principal, so no user context is required.
OAuth PassthroughNoRequires the signed-in user’s credentials, which aren’t available during alert evaluation.
Azure (On-Behalf-Of)NoActs on behalf of a specific user, whose credentials aren’t available during alert evaluation.

Warning

Don’t configure alert rules on a Databricks data source that uses OAuth Passthrough or Azure (On-Behalf-Of) authentication. Alert rules can’t run because there is no user context available to provide credentials for the query. For alerting, configure the data source with Personal Access Token, OAuth M2M, or Azure Entra ID M2M. Refer to Configure the Databricks data source.

Create an alert rule

To create an alert rule from a Databricks query:

  1. Write and test your query in a dashboard panel or in Explore.
  2. Make sure the query returns a numeric value that an alert condition can evaluate.
  3. Create the alert rule. Refer to Configure alert rules for the full workflow.

An alert query should reduce to a single numeric value that the alert condition can compare against a threshold. For example, the following query counts error events in the evaluation window:

SQL
SELECT count(*) AS error_count
FROM main.logs.application_events
WHERE severity = 'ERROR'
  AND $__timeFilter(event_time)

You can then add a threshold condition, such as error_count IS ABOVE 0, to fire the alert. If your query returns multiple rows or columns, use a reduce expression to collapse the result to a single value before the threshold condition.

Best practices for alert queries

Alert rules evaluate on a schedule, so an inefficient query runs repeatedly and adds load to your SQL warehouse. Follow these practices to keep alerting reliable:

  • Filter to a bounded time range. Use the $__timeFilter macro or an explicit WHERE clause so each evaluation scans only recent data instead of the whole table. Refer to Macros.
  • Return a small result. Aggregate to a single numeric value rather than selecting many rows. Avoid SELECT *.
  • Choose a sensible evaluation interval. Frequent evaluation of heavy queries multiplies warehouse load and cost.

Caution

A failing alert query is retried according to the data source’s retry settings. A misconfigured rule that queries a large, unfiltered table can generate a storm of retried queries that consume significant memory and can crash Grafana. Always filter alert queries and test them before you save the rule. Refer to Grafana runs out of memory or crashes.

Retry and timeout settings

The retry and timeout settings you configure on the data source also apply to alert rule evaluations:

  • Timeout - If a Databricks SQL warehouse is idle, the first query can be slow while the warehouse starts. Set the Timeout high enough that scheduled evaluations don’t fail while the warehouse resumes. Consider a serverless SQL warehouse for faster startup.
  • Retries and Retry timeout - Alert evaluations are retried on transient errors using the same retry settings as dashboard queries. Refer to Troubleshooting for the list of errors that trigger a retry.

Handle No Data and Error states

A Databricks SQL warehouse that has scaled to zero can take time to resume, so the first scheduled evaluation after an idle period might time out and put the rule in the Error state. Plan for this:

  • Configure how the rule behaves when it returns no data or encounters an error. Refer to Configure no data and error handling.
  • Set the Timeout and evaluation interval high enough to tolerate warehouse startup, or use a serverless SQL warehouse for faster resume times.

For more detail, refer to Alert evaluation times out while the SQL warehouse starts.