Skip to content

Comments

operator: fix errors/warnings metric.#8

Open
MitchLewis930 wants to merge 1 commit intopr_048_beforefrom
pr_048_after
Open

operator: fix errors/warnings metric.#8
MitchLewis930 wants to merge 1 commit intopr_048_beforefrom
pr_048_after

Conversation

@MitchLewis930
Copy link

@MitchLewis930 MitchLewis930 commented Jan 30, 2026

PR_048


Note

Low Risk
Small, localized changes to metrics initialization/registration; main risk is missed or double-counted errors_warnings increments during startup if ordering is wrong.

Overview
Ensures the errors_warnings metric is correctly emitted during early initialization, especially for the operator.

The operator now explicitly initializes and registers metrics.ErrorsWarnings (InitOperatorMetrics() + Registry.MustRegister(...)) and then flushes any pre-registry log counts. The pre-hive “flush” mechanism is refactored into an idempotent FlushLoggingMetrics() (via sync.Once) and ErrorsWarnings creation is centralized in newErrorsWarningsMetric() to support re-init for operator startup.

Written by Cursor Bugbot for commit f61651f. This will update automatically on new commits. Configure here.

This was broken during transition of pkg/metrics to integrate with Hive where relevant operator metrics where never initialized.
This adds a init func specific for operator and cleans up the "flush" logic used as a work around for errors/warnings emitted prior to agent starting (in the case of the operator).

Addresses: cilium#29525

Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
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.

2 participants