mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
chore(metrics): harden Cached exporter
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
This commit is contained in:
parent
acddfae356
commit
01ed0b9e54
1 changed files with 8 additions and 1 deletions
|
|
@ -13,6 +13,8 @@ use Generator;
|
|||
use OCP\ICache;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\OpenMetrics\IMetricFamily;
|
||||
use OCP\OpenMetrics\Metric;
|
||||
use OCP\OpenMetrics\MetricValue;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +45,12 @@ abstract class Cached implements IMetricFamily {
|
|||
public function metrics(): Generator {
|
||||
$cacheKey = static::class;
|
||||
if ($data = $this->cache->get($cacheKey)) {
|
||||
yield from unserialize($data);
|
||||
yield from unserialize(
|
||||
$data,
|
||||
[
|
||||
'allowed_classes' => [Metric::class, MetricValue::class],
|
||||
],
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue