Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto remove metric from registry #4

Merged
merged 3 commits into from
Feb 11, 2023
Merged

Auto remove metric from registry #4

merged 3 commits into from
Feb 11, 2023

Conversation

juvenn
Copy link
Owner

@juvenn juvenn commented Feb 11, 2023

When autoReset is enabled for reporter, we used to reset metric to zero after it's collected. It will result inactive zero metrics hanging and accumulating, it does not make sense and even misleading to report those inactive ones again and again. Another drawback is, some kinds does not support Clear, so it's not consistent across kinds.

So now we remove metric from registry after it being collected, instead. All kinds are consistent now, and inactive zero metrics will not reported again and again.

It should be noted, metric must be created dynamically with GetOrRegister to work with autoRemove. Otherwise the metric would never be registered after being removed.

@juvenn juvenn self-assigned this Feb 11, 2023
@juvenn juvenn merged commit 3cf677f into master Feb 11, 2023
@juvenn juvenn deleted the feat/auto-remove branch February 11, 2023 09:23
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