diff --git a/src/Prometheus/Storage/Redis.php b/src/Prometheus/Storage/Redis.php index f38391b5..7711f96b 100644 --- a/src/Prometheus/Storage/Redis.php +++ b/src/Prometheus/Storage/Redis.php @@ -204,6 +204,10 @@ public function updateCounter(array $data) private function collectHistograms() { $keys = $this->redis->sMembers(self::$prefix . Histogram::TYPE . self::PROMETHEUS_METRIC_KEYS_SUFFIX); + if ($keys === false) { + return array(); + } + sort($keys); $histograms = array(); foreach ($keys as $key) { @@ -278,6 +282,10 @@ private function collectHistograms() private function collectGauges() { $keys = $this->redis->sMembers(self::$prefix . Gauge::TYPE . self::PROMETHEUS_METRIC_KEYS_SUFFIX); + if ($keys === false) { + return array(); + } + sort($keys); $gauges = array(); foreach ($keys as $key) { @@ -304,6 +312,10 @@ private function collectGauges() private function collectCounters() { $keys = $this->redis->sMembers(self::$prefix . Counter::TYPE . self::PROMETHEUS_METRIC_KEYS_SUFFIX); + if ($keys === false) { + return array(); + } + sort($keys); $counters = array(); foreach ($keys as $key) {