Grafana
Connect
Connect Grafana from the terminal. Pass --help for the flags Grafana accepts.
polylane integration connect --type grafanaA stack URL and a service account token with the Editor role and the Alerting provisioning writer role.
Connect your Grafana Cloud stack with its URL and a service account token.
- Find your stack URL in the Grafana Cloud portal, under the details of your stack. It looks like https://yourstack.grafana.net.
- In your Grafana stack, open Administration → Users and access → Service accounts.
- Create a service account with the Editor role. Add the Alerting provisioning writer role (
fixed:alerting.provisioning:writer) to it. - Add a token to the service account. Paste the stack URL and the token into Polylane. Polylane checks the token and the alert provisioning permissions against your stack.
Polylane encrypts the token before it stores it, and the agent never sees it.
On connect, Polylane creates a webhook contact point named polylane in your stack. It adds a route to the contact point as the first route of your notification policy tree.
Register Grafana alerts to Polylane alongside your Terraform-managed resources.
The hourly sync keeps the polylane contact point and its route in place. The grafana_notification_policy resource manages the full policy tree, so a Terraform apply without the route removes it, and the next sync adds it again. Put the route first in your tree, with continue = true so your own routes still get every alert. Let Polylane manage the contact point:
resource "grafana_notification_policy" "tree" {
# ...
policy {
contact_point = "polylane"
continue = true
}
# your existing routes follow
}
Alert rules need no setup for each rule, because the route matches every alert.
How it works
Alerts start investigations
The Polylane route has no matchers, so it matches every alert. It has continue set to true, so your own routes still get every alert. Alert rules that you create later reach Polylane without more setup.
When an alert group fires, Polylane opens an issue and triages it. Only the alerts of the group that fire decide the triage. More notices of the same alert go to the same issue. A resolved notice goes on the issue timeline, and the agent uses it as evidence.
Every hour, Polylane puts back the contact point and the route if someone removed them. If Grafana refuses the change because of a permission, Polylane stops the hourly sync and tells you. The checks continue. Add the missing role to the same service account, then select Verify under Credentials on the integration page. Polylane then restores alert delivery with the same token.
On the Alerts tab of the integration page, turn automatic triage on or off for the connection or for each alert rule. The tab groups rules by rule group.
Checks
Polylane runs checks on your stack every 30 minutes. Built-in checks count alert instances that fire, alert rules whose last evaluation failed, and alert rules in the NoData state. Polylane also makes a check from each panel query on your dashboards, and from up to ten alert rule queries. Polylane skips a panel whose datasource is not on the stack, and names that datasource. Polylane reads error lines from your Loki application logs to find errors that it did not see before. It also finds signals: queries that watch one business operation, such as a checkout.
Under Anomaly detection on the integration page, change how often the checks run, or turn them off. Polylane also explores the connection when you connect it and every 12 hours, and opens an issue for each problem that it finds.
During an investigation
Agents search dashboards and read their panels, list datasources and check their health, and run PromQL, LogQL, TraceQL, and other datasource queries through the Grafana query proxy. They read alert rules, their live state, and the alerts that fire at that time, and read annotations. Agents can also create annotations, for example for a deploy, and send other Grafana API requests. Each change needs safety review and approval before it runs.
Troubleshooting
- The stack is unreachable. Grafana Cloud free-tier stacks hibernate after a period without use. Open the stack in your browser once, then try again.
- Alert delivery needs attention. The service account does not have the Alerting provisioning writer role. Add the role in Grafana, then select Verify under Credentials on the integration page. The Admin basic role of Grafana also includes this role.
Disconnecting
Disconnecting removes the Polylane route from your notification policy tree and deletes the polylane contact point. If the route is in Terraform, remove it at the same time. Then delete the service account token in Grafana.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Grafana is removed as well; nothing is left behind.
polylane integration disconnect <id>Tools
6Operations agents can perform in threads.