Skip to content

Fix auto-declaration with local counters - #2

Open
xsedla1o wants to merge 1 commit into
CESNET:masterfrom
xsedla1o:fix-sync_interval
Open

Fix auto-declaration with local counters#2
xsedla1o wants to merge 1 commit into
CESNET:masterfrom
xsedla1o:fix-sync_interval

Conversation

@xsedla1o

@xsedla1o xsedla1o commented Aug 3, 2026

Copy link
Copy Markdown

Fix event auto-declaration when local counters are enabled through sync_interval or sync_limit.

EventGroup.declare_event_id() previously iterated over the interval names in self.counters instead of the interval counter dictionaries. Logging an unknown event with both auto_declare_events and local counters enabled therefore raised a TypeError.

The declaration now:

  • initializes the event in every interval counter dictionary;
  • performs counter initialization under counter_lock, preventing races with logging and synchronization;
  • publishes the event ID only after its local counters have been initialized.

This has gone unnoticed as configurations used a sync-interval key with - instead of _, which disabled local counters silently.

A regression test covers declaring, logging, and synchronizing a dynamic event across multiple intervals.

python -m unittest discover -s tests -v

Ran 1 test in 0.001s
OK

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.

1 participant