Add config setting if the collector registry should be wiped #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR;
We can't wipe metrics on each metrics render, if we want to use
Counter
metric.Why this change?
I am working to introduce
Counter
metric type. This metrics works a bit different thanGauge
.Counter
could be set somewhere in the code and executed multiple times during the period between data sync to Prometheus. Of course, for this we need to use different Storage (notInMemory
). But this is a different topic, and right now it can be overwritten in the container. In the future maybe this package could also have a storage setting.And
Counter
value always goes up, so we don't need to wipe the storage on each request. Also, I don't see a reason, why we should wipe it forInMemory
storage as well, as the Gauge exporters right now works in the same request cycle.Some packages already have such a setting and is off by default:
Others don't have such setting, but don't wipe as well:
Looking forward to hear your opinion on that. Otherwise, we need to override the RenderAction just to remove
$this->registry->wipeStorage();
line. So maybe it's better to have in the package under the setting.