Skip to content

fix: clear registry on config reload to pick up new bucket settings - #747

Open
AruneshDwivedi wants to merge 1 commit into
prometheus:masterfrom
AruneshDwivedi:fix/config-reload-buckets
Open

fix: clear registry on config reload to pick up new bucket settings#747
AruneshDwivedi wants to merge 1 commit into
prometheus:masterfrom
AruneshDwivedi:fix/config-reload-buckets

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

Fixes #471

When the mapping configuration is reloaded via SIGHUP or lifecycle API, the MetricMapper is reinitialized but the Registry retains cached histogram/summary vectors with the old bucket or quantile settings. This causes the exporter to continue using stale configuration after reload.

Changes:

  • Add Reset() method to the Registry interface that clears all cached metrics
  • Call registry.Reset() after successful config reload in both SIGHUP and lifecycle API paths
  • Add unit tests for the Reset() method

Root cause: The Registry caches prometheus.HistogramVec and prometheus.SummaryVec objects. These are created once with the bucket/quantile configuration at the time of first use. When the mapping config is reloaded with different bucket settings, the old vectors are still returned for subsequent metric lookups.

When the mapping configuration is reloaded via SIGHUP or lifecycle API,
the MetricMapper is reinitialized but the Registry retains cached
histogram/summary vectors with the old bucket or quantile settings.
This causes the exporter to continue using stale configuration.

Add a Reset() method to the Registry interface and call it after
successful config reload to force re-registration of metrics with
the new bucket/quantile configuration.

Fixes prometheus#471

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
@pedro-stanaka

Copy link
Copy Markdown
Contributor

I dont think this will be needed anymore since:

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.

bug: Configuration reload does not affect bucket configuration

2 participants