Grafana: Best Practices
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Checked on 2026-11-09 against Grafana 13.3.x.
Best practices are the part of the documentation that people read last and forget first. Grafana publishes two short guides, one for dashboards and one for alerting, and a handful of pages elsewhere cover the pitfalls that hurt in production: label cardinality, interval variables and query load. This page turns them into working rules for the Bookshelf lab, shows how to judge the quality of an alert rule, lists the advice in older books and blog posts that is no longer true, and ends with a checklist to run before the lab is declared ready.
The page does not repeat the mechanics. Building a dashboard is in Building Dashboards, the tool-neutral design reasoning in Dashboard Design Principles and Designing Actionable Alerts, and the alerting resources in Alert Rules, Notification Policies and Provisioning Alerting Resources.
Dashboard best practices
The official guide has four parts: common observability strategies, a dashboard management maturity model, advice for creating dashboards and advice for managing them. The four parts answer different questions. The strategies decide what a dashboard shows, the maturity model tells you how well the whole collection is run, and the two lists are the daily rules.
Pick one strategy and write it down
The guide recommends choosing a consistent method for deciding what to monitor, so that dashboards look alike and the platform scales. The three it describes are:
-
USE (utilization, saturation, errors) for infrastructure resources such as CPU, memory and network devices.
-
RED (rate, errors, duration) for services, especially microservices; it approximates the experience of the users of a service.
-
The four golden signals (latency, traffic, errors, saturation) from the Google SRE book, which is RED plus saturation.
Its usage guideline is short and worth memorising: USE describes machine health and RED describes user happiness, USE tends to surface causes and RED symptoms, and alerts should be driven from RED dashboards. For Bookshelf that means the first row of "Bookshelf service health" is request rate, 5xx ratio and p95 latency per route (RED), and the infrastructure row (JVM, connection pool, database) sits lower, collapsed, as diagnostic context. The method itself is taught in RED, USE and the Golden Signals.
Know where your dashboards sit on the maturity model
The guide rates a dashboard collection as low, medium or high. The descriptions work as a self-assessment:
| Level | What it looks like | Moves to the next level by |
|---|---|---|
Low (default state) |
Anyone can edit anything; many copies with little reuse; one-off dashboards that are never removed; no version control for the dashboard JSON; long searches for the right dashboard; no alerts that link to dashboards. |
Template variables instead of a dashboard per node, with the data source itself as a variable; dashboards built around an observability strategy; overview-to-detail drill-downs; one row per service in data-flow order; meaningful colour and normalised axes (for example CPU as a percentage of cores); alerts linking to dashboards; JSON under version control. |
Medium (methodical dashboards) |
Variables, a strategy, hierarchies and links are in place. |
Actively reducing sprawl (periodic relevance review, approval before a dashboard goes on a master list, usage tracking; usage insights is an Enterprise capability); generating dashboards from code; no editing in the browser, viewers adapt a view through variables; testing in a separate non-production Grafana and promoting what works. |
High (optimised use) |
Dashboards are generated, reviewed and consistent; searching for a dashboard is the exception. |
Nothing further; keep reviewing. |
Bookshelf reaches the medium level from the start: one dashboard with env, service and route variables (see
Variables), links from every alert through the dashboard UID annotation,
and the JSON in Git. The high level is the as-code workflow of
Dashboards as Code, where nobody edits the saved dashboard by hand.
Rules for creating a dashboard
The "creating" part reads as a list of habits. In the order the guide gives them:
-
A dashboard tells a story or answers a question. Define the goal before the first panel; if there is none, question whether the dashboard is needed. Order information from general to specific and keep each graph focused on the question.
-
Reduce cognitive load. Make each graph’s meaning obvious at a glance and test the dashboard on someone who has never seen it, preferably under incident conditions.
-
Document it. Write the design guidelines down, add a text panel with purpose, links and instructions, and give panels a description (the tooltip behind the info icon).
-
Name things. Meaningful titles; prefix experiments with
TESTorTMP, include the owner’s name or initials, and delete temporary dashboards when finished. -
Do not refresh more often than the data changes. A 30-second refresh on hourly data only adds load to the network and the backend.
-
Use left and right Y axes when series have different units or ranges, and use stacking with care: it can mislead and hide data, and turning it off is usually the better default.
-
Reuse with templates and variables and cross-reference related dashboards.
Rules for managing dashboards
The "managing" part is about sprawl, the slow growth that turns a useful dashboard list into a landfill. The guide names the usual cause: duplicating a dashboard, changing one detail and keeping the original tags. Its remedies:
-
Remove unnecessary dashboards periodically and delete test dashboards (prefix
TEST:) after use. -
Avoid copies: a copy misses upstream fixes, documentation updates and new metrics. When a copy exists only to change template values, link to the master dashboard and customise it with URL parameters instead.
-
If a copy is unavoidable, rename it clearly and do not copy the tags, because tags drive search and copied tags cause false matches.
-
Provide a central index: dashboard, panel or data links, a dashboard list panel filtered by tag or folder, or a text panel with Markdown.
In the lab the rule is concrete: Bookshelf has exactly one service-health dashboard and one folder (bookshelf). A
second environment gets the env variable, not a copy. See
Annotations and Links for the link types and
Library Panels, JSON Model and Versions for
sharing a panel instead of duplicating it.
Alerting best practices
The alerting guide has ten sections. They are grouped here by the question each answers; the anchor of each section is on the
Source: line.
| Rule | What the guide says | In the Bookshelf lab |
|---|---|---|
Prioritise symptoms |
Page on user-facing symptoms such as latency, errors and availability, not internal events such as pod restarts. Keep infrastructure signals as early warnings and diagnostic context; send noisy ones to lower-severity channels (dashboards, alert lists, a non-paging chat channel). |
The pages are "high 5xx ratio" and "p95 latency above SLO"; JVM and pool saturation stay on the dashboard. |
Escalate on confidence |
Raise priority, widen the notification or open an incident when a failure is real and sustained or when signals correlate (high latency with a rising error rate), not on a brief or ambiguous signal. |
The pending period of the 5xx rule and, for a second tier, a notification policy that routes |
Scope with dimensions |
Use one multi-dimensional rule instead of one rule per host, service or endpoint. Start with a single dimension and add region or instance only when they help isolate causes. |
One p95 rule that produces one alert instance per |
Write for first responders |
Any on-call engineer should understand the problem and the next step: why the alert exists, what triggered it, how to investigate; annotations link dashboards and runbooks. If no action is possible, use a dashboard. |
Every lab rule has |
Give every alert an owner and a scope |
An owning team that maintains and responds; a system scope (service or component) that ties the alert to the owner. Route with a parent policy for the scope and nested policies for specific or higher-priority cases. |
Label |
Group |
One notification per incident instead of one per symptom, grouped along operational boundaries (service, owner); cascading failures appear as one issue. Email contact points can send a single email. |
The notification policy keeps the default grouping by |
Mitigate flapping |
Require a pending period; evaluate over windows and aggregate rather than alert on raw values; use percentiles instead of averages for latency and errors; use keep firing for or recovery thresholds. |
|
Graduate frequent alerts into SLOs |
Frequent symptom alerts signal a reliability problem worth managing formally; alert on error budget burn rate instead of every small deviation; a shared SLO gives teams one definition of good. |
The "SLO burn rate" alert (see SLIs, SLOs and Error Budgets). |
Review after incidents |
Check which alerts fired and whether they helped; adjust thresholds, priority or escalation; use narrowly scoped silences during incidents so unrelated alerts stay visible; add missing context. |
The silence exercise in the checklist below; see Silences, Mute Timings and Inhibition. |
Improve continuously |
Review alerts on a schedule, remove those that never lead to action, tune noisy ones, prefer fewer high-quality actionable alerts and keep the logic simple. |
Delete a lab alert you never reacted to; see the checklist below. |
The two links that matter most are the first and the fourth: an alert should describe a symptom, and the person who receives it should know what to do next. Everything else in the table is a refinement of those two. The tool-neutral version of the argument, with the cost of alert fatigue, is in Designing Actionable Alerts.
Sources (section anchors):
Rule quality
"Is this a good alert rule?" has a partly mechanical answer. The checks below are the ones Grafana can verify for you, and the review questions are the ones only a person can answer.
What can be checked mechanically: Alert Advisor
Alert Advisor (the alert rule list gets an Alert quality tab) compares Grafana-managed alert rules with a quality policy that requires labels and
annotations such as team, Runbook URL, Summary and Description. A rule is flagged when a required field is missing, empty or only whitespace.
The check is presence only: it does not test that the runbook link works or that the summary is any good. Details from the page:
-
Scope: one policy for all folders; data source-managed rules and recording rules are excluded. An empty policy checks nothing.
-
Modes: each requirement is either detect-only (the default for a new requirement: gaps are reported and nothing is blocked) or enforced (gaps also block creation and update through the supported provisioning paths).
-
Enforcement paths: Terraform and the alerting provisioning HTTP API. The Grafana rule editor is not enforced (its rules can still show findings), and requests that disable provenance, including Terraform with
disable_provenance = true, are exceptions. Enabling enforcement does not stop existing rules from evaluating or notifying. -
Score: the share of assessed rules that meet every configured requirement, on a 0 to 10 scale; it measures compliance with the policy, not accuracy, severity or noise. With no rules to assess it shows 10.0, so read the rule count beside it.
-
Permissions: configuring the policy needs the Admin role or the
alert.rules.quality:writeandalert.rules:readpermissions. -
Fixing findings: for provisioned rules change the source and apply it again; for rules edited in Grafana use Edit. Changing a label value can change routing, so keep it consistent with the notification policies.
The alert-rule-quality page states no release status or edition. The Grafana 13.3 "What’s new" page lists Alert Advisor as public preview on Grafana Cloud and Enterprise (open source is not listed), so check that the Alert quality entry exists in your own instance before building a process around it.
A sensible lab policy follows the canonical Bookshelf rules: require the team and severity labels and the summary and
runbook_url annotations, start detect-only, fix the findings in the provisioned YAML or Terraform and only then turn enforcement on
for the Terraform pipeline.
What only a person can judge
A rule can have every label and still be a bad rule. A review of each lab alert should answer these questions, which come straight from the alerting guide and the pages on states and missing data:
| Question | Where the answer lives |
|---|---|
Does it describe a symptom a user would feel? |
The query and condition (Alert Rules). |
What happens when the data stops, or the query errors? |
The No Data and Error handling choices (Rule Evaluation, States and Missing Data). |
Does it flap? |
Pending period, keep firing for and recovery threshold in the same page; the state history (Monitoring Alerts and State History). |
Who gets it, and does the notification say what to do? |
Labels, annotations and templates (Labels, Annotations and Rule Templates, Notification Templates). |
Is it cheap to evaluate? |
Evaluation interval, result-set size and query cost, below in the performance pitfalls. |
Did it ever lead to action? |
The notification and state history; an alert that only ever resolves itself is a candidate for deletion. |
A compact labels and annotations fragment in the file-provisioning format (the keys used in the lab, see Provisioning Alerting Resources for the complete rule):
for: 5m
keepFiringFor: 5m
labels:
team: bookshelf-sre
severity: critical
application: bookshelf
annotations:
summary: "Bookshelf 5xx ratio above 5 percent for 5 minutes"
runbook_url: "https://example.com/runbooks/bookshelf-5xx"
Reference: Grafana: Provision alert rules with files (the keepFiringFor key name is defined in the Grafana source file provisioning_alert_rules.go, grafana/grafana on GitHub).
Common pitfalls
The three pitfalls below cause most of the pain in a young Grafana setup. Each is tied to an official page; where a figure is only a rule of thumb it is labelled as such.
High cardinality
Every distinct combination of label values is a separate time series (Prometheus, Mimir) or a separate stream (Loki), and the cost of the index, the memory and the queries grows with their number. The official guidance is consistent across the projects:
-
Prometheus instrumentation guidance: most metrics should have no labels; keep the cardinality of a metric below about 10 label combinations, with only a handful of metrics above that across the whole system; above about 100 look for alternatives. The page’s example is a filesystem metric across 10,000 nodes (about 100,000 series, fine) versus adding a per-user dimension across 10,000 users (tens of millions, too many).
-
Loki label guidance: static labels of bounded values (region, cluster, application, namespace, environment) are good; use dynamic labels sparingly with values in the single digits or tens; never use unbounded values; a high-cardinality value that is often parsed at query time belongs in structured metadata, not in a label. Clients such as Alloy can add dynamic labels, so audit them (the page shows
logcli series --analyze-labels). -
Alerting: every series in a rule’s result is an alert instance whose state is written to the database. The alerting performance page recommends reducing cardinality by aggregating (alert per VM instead of per path and VM), and a self-managed
[quota] alerting_rule_evaluation_resultssetting can cap the results per rule (default unlimited; a rule over the cap goes to the Error state).
For Bookshelf this means: the uri label of the Micrometer HTTP metrics is a route template with a bounded number of values, which is
why per-route panels and the per-route p95 alert are safe; a user identifier, an order number or a traceId as a metric label or Loki
label is not. Keep trace_id as a field in the JSON log line and query it with a filter or
derived field (see Queries, Explore and Drilldown). The storage cost side is in
Storage, Retention and Cost.
To verify in the lab, query the number of series behind a suspicious metric in Explore:
count({__name__=~"http_server_requests_seconds.*", application="bookshelf"})
A count that grows while the traffic mix stays the same is a label with unbounded values.
Misusing the interval variables
$__interval is calculated from the time range and the panel width, grows when you zoom out and shrinks when you zoom in, and is also
available in milliseconds as $__interval_ms. The panel query options let you set Max data points (default: the panel width in pixels)
and Min interval (a floor for the calculated interval, which in Prometheus is the min step). Two mistakes recur:
-
A fixed range in
rate(), such as[5m], or $__interval as the range. A fixed window is wrong at every zoom level except one, and$__intervalcan be too small forrate()and then the graph shows gaps or inaccurate values; the Grafana page asks for a window that captures at least four scrape samples. -
Using $__rate_interval where a fixed value is required. It is not meant for recording rules, whose value depends on the evaluation context; use a fixed range there.
The Prometheus data source page defines $__rate_interval as max($__interval + scrape_interval, 4 * scrape_interval), where scrape_interval is the
per-query Min step if set and otherwise the data source’s Scrape interval (the panel Min interval does not enter the calculation). That is why
the data source’s scrape interval must match the Prometheus configuration: a mismatch can produce no data.
# Wrong at most zoom levels: the window is fixed, or can fall below the scrape interval
sum(rate(http_server_requests_seconds_count{application="bookshelf"}[5m]))
sum(rate(http_server_requests_seconds_count{application="bookshelf"}[$__interval]))
# Right for panels: the window follows the zoom level and always covers four scrapes
sum(rate(http_server_requests_seconds_count{application="bookshelf"}[$__rate_interval]))
Reference: Grafana: Prometheus template variables, use rate interval; the calculation is in how it is calculated and the data source setting in configure it correctly.
The interval variables are also described with the other dashboard variable families in Variables; rules for alerts are in Alert Rules: Queries and Conditions.
Sources: Grafana: query options, interval, max data points and min interval.
Too many panels, too many queries
Each panel runs its own queries when the dashboard loads and on every refresh, so panel count, repeated panels and refresh rate multiply the load on the data sources and on the browser. The official dashboard guide gives the first rules: do not refresh more often than the data changes, keep graphs focused on one question, and split by purpose (overview to detail) instead of piling everything on one screen. The Grafana Labs blog post on dashboard query performance (written as general guidance, not a reference page) adds the practical ones:
-
Reuse one panel’s query result in other panels instead of re-running identical queries .
-
Replace one panel per server with a single panel and query, and show the per-server values with a table, gauge or heatmap.
-
Lengthen the refresh interval or switch auto-refresh off for dashboards with expensive queries.
-
Precompute expensive expressions with recording rules (see Recording Rules).
-
Narrow selectors, avoid very large range windows, avoid grouping by high-cardinality labels and avoid heavy regular expressions.
Panel-count figures quoted in forums and blog posts (10 to 20 per dashboard, 50 or more being too many) are rules of thumb and not an official limit; the useful test is the dashboard’s load time, not its panel count. A repeated row or panel multiplies queries by the number of selected variable values, so repeat on a variable with a bounded value list and avoid the All option on variables with many values.
To verify in the lab, open the dashboard, open the Query inspector of the slowest panel (see Queries, Explore and Drilldown) and hide or remove panels one by one until the slow one is identified.
Alert evaluation load
The same arithmetic applies to alerting. The performance page says capacity depends on the number of rules, how often they evaluate, how many
instances they produce and how heavy the queries are, and recommends the lowest acceptable evaluation frequency first, then lower cardinality,
then faster queries. Periodic state saving reduces database writes at the cost of stale state after a crash, which can cause duplicate notifications. The operating side (meta-monitoring metrics such as
grafana_alerting_rule_evaluations_total, high availability) is in
Alerting HA and Operations.
In the books
Chapter 15 of Observability with Grafana (Chapman and Holmes, Packt, 2023, written for Grafana 10.2) collects best practices as a list of decisions to make early: choose an extensible log format and select Loki labels carefully for performance and cardinality, drop metrics and high-cardinality labels you do not need, protect the system from verbose metric protocols, fix cardinality early with team standards and governance, monitor platform cost where data collection makes fixing it cheap, and keep high-load, low-value environments such as performance tests away from production observability. That advice has aged well and agrees with the pitfalls above. What has changed is the tooling it names: it presents Grafana Agent Flow as the way to build collection pipelines, and Grafana Agent has since reached end of life in favour of Grafana Alloy (see the table below).
Outdated advice from older material
Books, blog posts and conference slides written for Grafana 8 to 10 still circulate. The table lists the advice that no longer holds. Each row has a source on an official or project page; "Current" is what to use in Grafana 13.3.
| Older advice | Current | What changed | Source |
|---|---|---|---|
Collect with Grafana Agent (Static, Flow or Operator) |
Grafana Alloy |
Grafana Agent Static, Flow and Operator reached end of life on 1 November 2025. Grafana provides migration tools and documentation for moving to Alloy. |
|
Ship logs with Promtail |
Grafana Alloy |
Promtail reached end of life on 2 March 2026: commercial support has ended and no updates will come. The lambda-promtail client is not part of that deprecation. Alloy has a built-in |
|
Legacy dashboard alerting |
Grafana Alerting |
Legacy alerting was removed in Grafana 11.0.0; Grafana 10.4 was the last version offering it and its automatic upgrade. A Grafana 11 start with legacy alerting still enabled stops with an error; confirming that you do not upgrade leaves a blank alerting slate. |
|
Graph, Singlestat, Table (old) and Worldmap panels |
Time series, Stat, Table and Geomap |
Angular plugin support was deprecated and turned off by default in Grafana 11 and removed in Grafana 12. The archived Angular page maps Graph (old) to Time series, Singlestat and Stat (old) to Stat, Table (old) to Table and Worldmap to Geomap. |
What’s new in 12.0, removal of Angular, Angular plugins (archived 12.1) |
API keys for HTTP API access |
Service accounts with tokens |
API keys are deprecated and service accounts replace them. Existing keys convert into service accounts with tokens and keep working; migrating all keys ends the ability to create new ones. The Terraform |
|
Grizzly, Grafonnet and grafanactl for dashboards and resources as code |
Foundation SDK for typed dashboards; |
The Grizzly README marks it for deprecation in favour of grafanactl and its GitHub repository is archived. The Grafana CLI page lists grafanactl as deprecated and recommends |
Foundation SDK, Grafana CLI, Grizzly README, Grafonnet README |
Public dashboards |
Externally shared dashboards (Share externally; Dashboards, Shared dashboards) |
The feature formerly called public dashboards is now called externally shared dashboards, and the email option is now "Share externally with specific people". Variables and queries that use variables are still not supported. |
The Angular row also explains why very old dashboards fail to load panels after an upgrade: the panel type no longer exists, and the
automatic migration (the autoMigrateOldPanels feature toggle documented on the archived page) only covers the listed plugins. Details of the panel replacements are in
Choosing a Visualization and
Graphs and Charts; the collection side is in
Telemetry Collection Pipelines; the as-code side in
Dashboards as Code.
Pre-flight checklist for the Bookshelf lab
Run this list after docker compose --profile grafana up -d (see Hands-on Lab) and before
breaking the service on purpose. Each item names the page that explains it.
Collection and data
-
Bookshelf exposes
/actuator/prometheusand the Prometheus data source (uidprometheus) showsup{job="bookshelf"}equal to 1 (Data Sources). -
The data source Scrape interval equals the Prometheus configuration, so panels that use $__rate_interval do not come back empty.
-
No label of the Bookshelf metrics or logs carries an unbounded value (no user id, order id or trace id); the
count()query above is flat under steady load. -
The collector is Grafana Alloy; no Grafana Agent or Promtail remains in the compose file.
Dashboard
-
One dashboard "Bookshelf service health" (uid
bookshelf-service-health) in the folderbookshelf, with the RED row first and the dependencies row collapsed. -
Every panel has a title and a description; units are set; rate panels use $__rate_interval.
-
The dashboard has a text panel or description naming its purpose and owner, and its JSON is in Git (no edits in the browser).
-
Auto-refresh is no faster than the scrape interval allows; the slowest panel loads in an acceptable time in the query inspector.
-
No dashboard is shared externally and no API key is used; scripts authenticate with a service account token.
Alerting
-
The five rules exist (high 5xx ratio, p95 latency above SLO, no data, error-log spike, SLO burn rate), each in the folder
bookshelfwith the labelsteam=bookshelf-sreandseverity, and the annotationssummary,runbook_urland the dashboard UID. -
The 5xx rule uses a 0.05 threshold over 5 minutes with a pending period; the p95 rule uses 0.5 s with a recovery threshold.
-
Every rule has an explicit No Data and Error choice (Rule Evaluation, States and Missing Data).
-
The notification policy routes
team=bookshelf-sreto the contact pointbookshelf-webhook, which posts tohttp://webhook-receiver:8080/grafana; the contact point Test delivers to the receiver. -
Alert state history is enabled with Loki, so a fired alert can be explained afterwards (Monitoring Alerts and State History).
-
The rules and policies are provisioned from files or Terraform, not clicked together (Provisioning Alerting Resources).
-
Alert Advisor, if available in your instance, shows no findings for the five rules.
Exercise, then review
-
Switch the load generator to failing-request mode: the 5xx alert goes Pending, then Firing, the webhook receives one grouped notification, and it resolves after the load generator returns to normal.
-
Silence one alert narrowly (by
alertname), confirm the other alerts still notify, then end the silence. -
After the exercise decide for each alert: keep, tune or delete.
Source: the items are the application of the guides cited above (dashboard best practices and alerting best practices) to the lab values; the end-to-end build is in Bookshelf End to End.