canonical / grafana-cloud-integrator

This charmed integrator automates the operational procedures of making Grafana Agent ship telemetry to the Grafana Cloud.
https://charmhub.io/grafana-cloud-integrator
Apache License 2.0
1 stars 1 forks source link

fix: remove unnecessary leadership guards in GrafanaCloudConfigRequirer #13

Closed ca-scribner closed 1 month ago

ca-scribner commented 1 month ago

Issue

Previously, GrafanaCloudConfigRequirer would only emit a cloudconfig* event on relation changed/broken if this unit is a leader. This caused issues with multi-unit deployments as described in #12.

Solution

Since GrafanaCloudConfigRequirer only reads the relation remote's application_data, there is no need for a leadership guard because non-leader units have permission to read this data. The current commit removes these guards.

Context

closes #12

Testing Instructions

See this grafana-agent patch for testing instructions

Release Notes

ca-scribner commented 1 month ago

Yep good points.

ca-scribner commented 1 month ago

@PietroPasotti added some tests like you mentioned to assert the correct events are emitted