Skip to content

Commit

Permalink
Handle non-existing histogram keys in redis storage
Browse files Browse the repository at this point in the history
Resolves: Jimdo#92
  • Loading branch information
cweiske committed Nov 6, 2018
1 parent 01c8937 commit ea250c1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Prometheus/Storage/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit ea250c1

Please sign in to comment.