Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alertmanager Integration #129

Merged
merged 6 commits into from
Apr 5, 2022
Merged

Alertmanager Integration #129

merged 6 commits into from
Apr 5, 2022

Conversation

rbarry82
Copy link
Contributor

@rbarry82 rbarry82 commented Apr 1, 2022

Issue

Implement integration between Alertmanager and Loki, so any alerting rules actually fire alerts.

Solution

Primarily this was simply additions to metadata.yaml and small changes to the charm. The bulk of it was the creation of a workload-less tester charm which can generate messages in an arbitrary format through Juju actions.

Testing Instructions

Deploy Loki and Alertmanager, as well as some charm which includes alerting rules (or cos-config with rules which match). See if alerts fire.

Release Notes

Integrate Loki and Alertmanager, so that alerts fired by Loki based on LogQL alert rules are sent to Alertmanager for routing.

Balbir Thomas and others added 3 commits March 24, 2022 16:18
This commit introduces a Loki tester charm for the purpose
of integration testing the Loki charm. The loki tester
charm forwards its own Python debug logs to Loki, when
a Juju relation is created between it and the Loki charm.
Normally the tester charm only forwards Python debug logs
to Loki. The tester charm also provides and Juju action
"log-error" which logs and error message to loki. The
tester charm contains an alert rule which is also forwarded
to Loki. This alert rule triggers an alert any time
an error log is received by Loki.
This commit adds an integration test to check that
LokiPushApiConsumer can forward logs and alert rules
to LokiPushApiProvider. The test further checks
conditions satisfying the alert rules do indeed raise
alerts.
@github-actions
Copy link

github-actions bot commented Apr 1, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

sed-i
sed-i previously approved these changes Apr 1, 2022
tests/integration/test_alert_rules_fire.py Outdated Show resolved Hide resolved
tests/integration/conftest.py Show resolved Hide resolved
tests/integration/loki-tester/LICENSE Outdated Show resolved Hide resolved
balbirthomas
balbirthomas previously approved these changes Apr 1, 2022
tests/integration/conftest.py Show resolved Hide resolved
tests/integration/helpers.py Show resolved Hide resolved
tests/integration/loki-tester/LICENSE Outdated Show resolved Hide resolved
tests/integration/loki-tester/README.md Outdated Show resolved Hide resolved
tests/integration/test_alert_rules_fire.py Outdated Show resolved Hide resolved
tests/integration/test_alert_rules_fire.py Show resolved Hide resolved
@balbirthomas balbirthomas dismissed stale reviews from sed-i and themself via 214d3aa April 1, 2022 10:47
@github-actions
Copy link

github-actions bot commented Apr 1, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

Add a helper method to also check the Prometheus-compatible
alerts endpoint from Loki itself, so we can check there as a
bisection point between Alertmanager.

Add a test which exercises this endpoint.

Typos and cleanup.

Add a (very temporary) FIXME so the "other" test which uses
Alertmananager can be moved to the bundle when this merges
@github-actions
Copy link

github-actions bot commented Apr 1, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

balbirthomas
balbirthomas previously approved these changes Apr 1, 2022
@github-actions
Copy link

github-actions bot commented Apr 1, 2022

Libraries are not up to date with their remote counterparts. If this was
not intentional, run charmcraft fetch-libs and commit the updated libs
to your PR branch.

stdout
Library charms.alertmanager_k8s.v0.alertmanager_dispatch was already up to date in version 0.3.                                                                
Library charms.grafana_k8s.v0.grafana_source was already up to date in version 0.9.                                                                            
Library charms.loki_k8s.v0.loki_push_api has local changes, cannot be updated. 
Library charms.observability_libs.v0.kubernetes_service_patch was already up to date in version 0.6.                                                           

stderr

@rbarry82 rbarry82 requested review from sed-i and mmanciop April 4, 2022 14:02
tests/integration/loki-tester/.flake8 Show resolved Hide resolved
tests/integration/test_alert_rules_fire.py Show resolved Hide resolved
@rbarry82 rbarry82 merged commit c7e25d6 into main Apr 5, 2022
@rbarry82 rbarry82 deleted the alerting-itest branch April 5, 2022 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants