- Documentation
- Learning Hub
- Journey Introduction to Grafana Alerting
- Section 6 of 6 Create an alert with code
Build an alert with code
Slide 1 of 3
Build an alert with the Code mode
You just built an alert in Builder mode. Code mode follows the same rule flow. The difference is how you write the query: you type PromQL instead of picking the metric and operations from menus in the UI.
Start in Builder when you’re learning. Switch to Code when you need more control than Builder can express clearly.
Path
This Path walks you through writing the alert query in PromQL, then creating a silence to suppress notifications during maintenance.
Learning path
First alert rule with query language
Build a Grafana alert rule in Code mode — write a PromQL error-rate query, set a condition, add labels, configure evaluation and notifications, and save.
14 min
Intermediate
Docs & blog posts
Open in Grafana Cloud
Complete this learning path directly in your Grafana Cloud stack with an interactive learning experience.