Skip to content

Commit d6233cc

Browse files
iKsSsiksss-invia
andauthored
Redis - Metrics collection should not write anything (#165)
Signed-off-by: Jakub Pastuszek <jakub.pastuszek@invia.cz> Co-authored-by: Jakub Pastuszek <jakub.pastuszek@invia.cz>
1 parent 6d7328e commit d6233cc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Prometheus/Storage/Redis.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,11 @@ private function collectSummaries(): array
536536
}
537537

538538
if (count($samples) === 0) {
539-
$this->redis->del($valueKey);
539+
try {
540+
$this->redis->del($valueKey);
541+
} catch (\RedisException $e) {
542+
// ignore if we can't delete the key
543+
}
540544
continue;
541545
}
542546

@@ -571,7 +575,11 @@ private function collectSummaries(): array
571575
if (count($data['samples']) > 0) {
572576
$summaries[] = $data;
573577
} else {
574-
$this->redis->del($metaKey);
578+
try {
579+
$this->redis->del($metaKey);
580+
} catch (\RedisException $e) {
581+
// ignore if we can't delete the key
582+
}
575583
}
576584
}
577585
return $summaries;

0 commit comments

Comments
 (0)