diff --git a/src/Prometheus/Storage/APC.php b/src/Prometheus/Storage/APC.php index b608e49..3340566 100644 --- a/src/Prometheus/Storage/APC.php +++ b/src/Prometheus/Storage/APC.php @@ -155,6 +155,7 @@ private function collectCounters() 'help' => $metaData['help'], 'type' => $metaData['type'], 'labelNames' => $metaData['labelNames'], + 'samples' => array(), ); foreach (new \APCUIterator('/^prom:counter:' . $metaData['name'] . ':.*:value/') as $value) { $parts = explode(':', $value['key']); @@ -185,6 +186,7 @@ private function collectGauges() 'help' => $metaData['help'], 'type' => $metaData['type'], 'labelNames' => $metaData['labelNames'], + 'samples' => array(), ); foreach (new \APCUIterator('/^prom:gauge:' . $metaData['name'] . ':.*:value/') as $value) { $parts = explode(':', $value['key']); @@ -216,7 +218,8 @@ private function collectHistograms() 'help' => $metaData['help'], 'type' => $metaData['type'], 'labelNames' => $metaData['labelNames'], - 'buckets' => $metaData['buckets'] + 'buckets' => $metaData['buckets'], + 'samples' => array(), ); // Add the Inf bucket so we can compute it later on diff --git a/src/Prometheus/Storage/InMemory.php b/src/Prometheus/Storage/InMemory.php index 313dbf4..7d5ac42 100644 --- a/src/Prometheus/Storage/InMemory.php +++ b/src/Prometheus/Storage/InMemory.php @@ -41,7 +41,8 @@ private function collectHistograms() 'help' => $metaData['help'], 'type' => $metaData['type'], 'labelNames' => $metaData['labelNames'], - 'buckets' => $metaData['buckets'] + 'buckets' => $metaData['buckets'], + 'samples' => array(), ]; // Add the Inf bucket so we can compute it later on @@ -114,6 +115,7 @@ private function internalCollect(array $metrics) 'help' => $metaData['help'], 'type' => $metaData['type'], 'labelNames' => $metaData['labelNames'], + 'samples' => array(), ]; foreach ($metric['samples'] as $key => $value) { $parts = explode(':', $key);