APCng collect - do not throw exception if a metakey is missing #151
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.
These changes should fix the following issues:
#124
#126
The main idea of this PL is following: when we use APCng with ttl 0 we have no guaranty that our data will not be removed from the cache. So the case when we can't find some metakey in the cache is common and we shouldn't rise the exception that stops completely the metrics collection process.
The same solution is already implemented in the Redis Storage:
prometheus_client_php/src/Prometheus/Storage/Redis.php
Lines 407 to 409 in a09ea80
prometheus_client_php/src/Prometheus/Storage/Redis.php
Lines 503 to 507 in a09ea80
prometheus_client_php/src/Prometheus/Storage/Redis.php
Lines 590 to 592 in a09ea80
prometheus_client_php/src/Prometheus/Storage/Redis.php
Lines 626 to 628 in a09ea80
No meta data - no statistics.
Another problem here is that the metadata stored only once for a metric. So if we loose metadata from the cache, the metric will continue collecting but we lost access to it. So I made calling of storeMetadata function always, not only on the first writing of the metric. This function checks inside that metadata is already exists in the cache and will not do anything if it is.