feat: loki alert rules - #124
Merged
Merged
Conversation
Adds default loki alert rules to help when setting up loki for juju.
iyiguncevik
approved these changes
Jul 14, 2026
Comment on lines
+6
to
+9
| sum(rate({%%juju_topology%%} |= "ERROR" [5m])) by (juju_model, juju_model_uuid, juju_application) | ||
| / | ||
| sum(rate({%%juju_topology%%}[5m])) by (juju_model, juju_model_uuid, juju_application) | ||
| > 0.05 |
There was a problem hiding this comment.
This is generally correct. Probably there are always enough logs that we don't need to consider low-volume scenario like there are 3 logs for 5 minutes and 1 of the is error level.
Comment on lines
+30
to
+32
| The Juju controller has logged a FATAL error or panic in the last | ||
| 5 minutes. This indicates a critical failure that may require | ||
| immediate investigation. |
There was a problem hiding this comment.
Not in last 5 minutes to be exact. This will fire as soon as possible. You could also change the range from 5m to 1m, but that also doesn't matter so much.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Juju controller charm forwards its workload logs to Loki via the loki-push-api relation, and the LokiPushApiConsumer library defaults to forwarding alert rules from
./src/loki_alert_rules/.Adds
src/loki_alert_rules/juju_controller_alerts.yamlwith three LogQL alert rules, each scoped to the charm's Juju topology via the%%juju_topology%%placeholder (automatically resolved by the library):