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.
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.
These changes should fix the following issues: https://github.com/PromPHP/prometheus_client_php/issues/124 https://github.com/PromPHP/prometheus_client_php/issues/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: https://github.com/PromPHP/prometheus_client_php/blob/a09ea80ec1ec26dd1d4853e9af2a811e898dbfeb/src/Prometheus/Storage/Redis.php#L407-L409 https://github.com/PromPHP/prometheus_client_php/blob/a09ea80ec1ec26dd1d4853e9af2a811e898dbfeb/src/Prometheus/Storage/Redis.php#L503-L507 https://github.com/PromPHP/prometheus_client_php/blob/a09ea80ec1ec26dd1d4853e9af2a811e898dbfeb/src/Prometheus/Storage/Redis.php#L590-L592 https://github.com/PromPHP/prometheus_client_php/blob/a09ea80ec1ec26dd1d4853e9af2a811e898dbfeb/src/Prometheus/Storage/Redis.php#L626-L628
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.