Skip to content

fix(prometheus): filter unregistered tag labels to prevent metric update errors#1

Merged
xfactor-toml merged 2 commits intomasterfrom
prometheus-logging-noise
Jan 28, 2026
Merged

fix(prometheus): filter unregistered tag labels to prevent metric update errors#1
xfactor-toml merged 2 commits intomasterfrom
prometheus-logging-noise

Conversation

@xfactor-toml
Copy link
Owner

Tags created after server startup were causing Prometheus metric update errors because they weren't included in the initial labelset registered during init().

This fix:

  • Adds a static Set to track tag labels registered at init time
  • Filters out unregistered tags in mapTagsToLabels() before they reach prom-client
  • Logs a warning message once per tag (not on every heartbeat) guiding users to restart the server for new tags to appear in Prometheus metrics

This aligns with the existing documented behavior that new tags require a restart, but now handles it gracefully instead of throwing errors on every heartbeat.

Fixes louislam#6728

…ate errors

Tags created after server startup were causing Prometheus metric update errors
because they weren't included in the initial labelset registered during init().

This fix:
- Adds a static Set to track tag labels registered at init time
- Filters out unregistered tags in mapTagsToLabels() before they reach prom-client
- Logs a warning message once per tag (not on every heartbeat) guiding users
  to restart the server for new tags to appear in Prometheus metrics

This aligns with the existing documented behavior that new tags require a restart,
but now handles it gracefully instead of throwing errors on every heartbeat.

Fixes louislam#6728
@autofix-troubleshooter
Copy link

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

@xfactor-toml xfactor-toml merged commit 0c20e82 into master Jan 28, 2026
24 checks passed
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.

Prometheus logging noise due to cloning tags: Added label "tag" is not included in initial labelset

2 participants