Alerting and Notification
Use Grafana Alerting to evaluate SQL query results from your VeloDB Cloud warehouse and notify your team when a condition is met. Grafana runs the queries and sends the notifications. These rules are managed in your Grafana deployment.
An alert rule defines a query, a threshold, and an evaluation schedule. When the result meets the condition for the configured pending duration, the alert enters the firing state. Grafana sends notifications to a contact point directly or routes them through notification policies.

Prerequisites
- Configure a Grafana MySQL data source that can read your warehouse telemetry. See Dashboards.
- Use a Grafana role with permission to create alert rules, and have access to the destination folder and contact points.
- Make sure Grafana can reach both the warehouse and the notification service. Email, webhooks, and other channels require their own service configuration or credentials.
- Choose the measurement, threshold, evaluation interval, and pending duration for your workload. Frequent evaluations and broad queries consume warehouse compute. See Billing.
The following example alerts when more than 10 log rows match error in the last 10 minutes. It counts matching rows, which may differ from the number of failed requests.
1. Create a rule
In Grafana, open Alerting > Alert rules and create an alert rule. Choose your warehouse data source. Grafana labels can vary by version. The screenshots show one example workflow.

2. Define the query and condition
Switch the query editor to Code and enter:
SELECT COUNT(*) AS error_count
FROM otel.otel_logs
WHERE timestamp >= NOW() - INTERVAL 10 MINUTE
AND timestamp < NOW()
AND body MATCH_ANY 'error';
Use the database and table names configured for your exporter. Confirm that its timestamp values and the SQL session use the intended timezone. This example returns one numeric column suitable for a table-based alert condition. Select Table as the query format where that setting is available.
Set the threshold to error_count > 10. For a query that returns multiple points or series, add the appropriate reduction or expression before applying the threshold.
Preview the query and condition. Check the returned count against the same query in your warehouse before enabling notifications. The count in the screenshot is illustrative and depends on its dataset and time range.

For supported result formats and expressions, see Create Grafana-managed alert rules.
3. Configure evaluation
Choose a folder and evaluation group, then set the evaluation interval and pending duration.
For example, evaluating every minute with no pending duration lets the rule enter the firing state at the first evaluation that meets the threshold. A nonzero pending duration requires the condition to persist across evaluations before it fires.
Configure how the rule handles query errors and no-data results. A network failure or permission error should not silently appear to be a healthy application. For details, see Alert rule evaluation.

4. Configure notifications
Choose or create a contact point, such as email, Slack, PagerDuty, or a webhook. Configure its destination and credentials, then use its test function to confirm delivery.
If you route notifications through policies, add labels that match the intended route. Check grouping and repeat intervals so that related alert instances produce the notifications you expect. See Grafana notifications.


5. Add response context and verify
Add a summary, description, and runbook URL so that recipients can identify the affected service and respond. Keep credentials and sensitive log contents out of notification messages.
Save the rule and inspect its evaluation state. In a test environment, use a known query result or temporary threshold to verify the firing and resolved states, then restore the intended condition. Confirm receipt at the contact point as well as the rule state in Grafana.

Manage and remove rules
After creating a rule, you can change its query, threshold, evaluation settings, and notification route. Pause the rule's evaluation when you want it to stop querying the warehouse. A silence or mute timing suppresses notifications while evaluations can continue.
Remove test rules when you finish. Deleting a dashboard does not necessarily remove independent alert rules. For details, see Monitor alerting.

Common errors
| Symptom | Check and resolution |
|---|---|
| Query fails during evaluation | Confirm that the data source supports backend alert queries, the warehouse is reachable, and the SQL user has read privileges. |
| Rule reports an unsupported result format | Return numeric values in a supported table or time series format. Reduce multiple points before applying a scalar threshold. |
| Rule remains pending | Check the pending duration and whether the condition remains true across evaluations. |
| Rule is firing but no notification arrives | Test the contact point, then inspect notification policies, label matching, grouping, silences, mute timings, and outbound network access. |
| Rule fires repeatedly during warehouse failures | Review the query-error and no-data handling settings and separate application symptoms from data-source availability alerts. |