grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
968 stars 103 forks source link

loki.rules.kubernetes: Add support for clustered mode #1057

Open ToonTijtgat2 opened 1 week ago

ToonTijtgat2 commented 1 week ago

PR Description

This change adds support for updating Loki rules based on PrometheusRule objects when running in clustered mode. It does this by picking a single instance to be the leader responsible for making changes using the Loki API. Other non-leader instances will not process events or make calls to the Loki API.

Which issue(s) this PR fixes

Fixes #976

Notes to the Reviewer

PR Checklist

ToonTijtgat2 commented 1 week ago

@thampiotr Thanks for running the tests, I adapted the code according to the results. can you please run them again? Thanks

ToonTijtgat2 commented 1 week ago

Did a new commit with fixes. @thampiotr, let's hope it's better now.

ToonTijtgat2 commented 1 week ago

use sync loki instead of eventprocessor. I hope this solves it @thampiotr

ToonTijtgat2 commented 5 days ago

@thampiotr Thanks for running the tests, made some mistakes I tried to solve now, can you run them again for https://github.com/grafana/alloy/pull/1057 and https://github.com/grafana/alloy/pull/1058? Thanks

ToonTijtgat2 commented 5 days ago

Dear @thampiotr, I added to sync state to the iteration, that was missing. To be honest, I'm not sure if I'm going to the correct direction with this PR.

For the PR of https://github.com/grafana/alloy/pull/1058 It seems I'm more close to the end. since it's only the test that's failing (hopefully resolved by my last commit.)