Repository navigation
Send GA4 Ping from Node with leader election - #498
Open
tiagolobocastro wants to merge 2 commits into
Open
tiagolobocastro wants to merge 2 commits into
tiagolobocastro wants to merge 2 commits into
Conversation
tiagolobocastro
commented
Nov 6, 2026
Member
The install/ping events were sent from the controller, so disabling the components which need it (eg: resize) stopped them altogether. Sending them from every node plugin instead would show up as duplicates. Run the analytics from the node plugins, where a Lease based leader election (rawfile-analytics) picks a single sender. The lease lasts 180s and is renewed every 60s; on any error leadership is dropped right away. Followers take over once the lease expires, resuming the ping schedule from the timestamps in the rawfile-config configmap, so no new install event is sent. To avoid duplicate pings, before sending one we also check that the lease was renewed recently (a paused leader may resume still believing it leads), and re-read the last ping timestamp from the configmap in case another leader pinged meanwhile. The analytics ClusterRole gains create/get/update on leases. Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
Add unit tests for the analytics lease election, using an in-memory API server which enforces the resourceVersion, and for the ping loop, using an in-memory configmap: - concurrent acquires of a free lease: one wins, the other gets a 409 - an unexpired lease is not taken, an expired one is taken over - a failing leader steps down right away, the others take over only once the lease expires - a paused leader (stale renewal) neither leads nor pings, while the new leader carries on the schedule without a new install event - a ping is skipped and rescheduled if another leader pinged meanwhile - a regained leader resumes from the other leader's last ping Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
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.