@@ -485,7 +485,7 @@ private function collectSummaries(): array
485
485
{
486
486
$ math = new Math ();
487
487
$ summaryKey = self ::$ prefix . Summary::TYPE . self ::PROMETHEUS_METRIC_KEYS_SUFFIX ;
488
- $ keys = $ this ->getRedisKeys ($ summaryKey . ':*:meta ' );
488
+ $ keys = $ this ->redis -> keys ($ summaryKey . ':*:meta ' );
489
489
490
490
$ summaries = [];
491
491
foreach ($ keys as $ metaKeyWithPrefix ) {
@@ -506,7 +506,7 @@ private function collectSummaries(): array
506
506
'samples ' => [],
507
507
];
508
508
509
- $ values = $ this ->getRedisKeys ($ summaryKey . ': ' . $ metaData ['name ' ] . ':*:value ' );
509
+ $ values = $ this ->redis -> keys ($ summaryKey . ': ' . $ metaData ['name ' ] . ':*:value ' );
510
510
foreach ($ values as $ valueKeyWithPrefix ) {
511
511
$ valueKey = $ this ->removePrefixFromKey ($ valueKeyWithPrefix );
512
512
$ rawValue = $ this ->redis ->get ($ valueKey );
@@ -518,7 +518,7 @@ private function collectSummaries(): array
518
518
$ decodedLabelValues = $ this ->decodeLabelValues ($ encodedLabelValues );
519
519
520
520
$ samples = [];
521
- $ sampleValues = $ this ->getRedisKeys ($ summaryKey . ': ' . $ metaData ['name ' ] . ': ' . $ encodedLabelValues . ':value:* ' );
521
+ $ sampleValues = $ this ->redis -> keys ($ summaryKey . ': ' . $ metaData ['name ' ] . ': ' . $ encodedLabelValues . ':value:* ' );
522
522
foreach ($ sampleValues as $ sampleValueWithPrefix ) {
523
523
$ sampleValue = $ this ->removePrefixFromKey ($ sampleValueWithPrefix );
524
524
$ samples [] = (float ) $ this ->redis ->get ($ sampleValue );
@@ -642,31 +642,6 @@ private function getRedisCommand(int $cmd): string
642
642
}
643
643
}
644
644
645
- /**
646
- * @param string $pattern
647
- * @return mixed[]
648
- */
649
- private function getRedisKeys (string $ pattern ): array
650
- {
651
- $ prefix = $ this ->redis ->getOption (\Redis::OPT_PREFIX );
652
- $ optScan = $ this ->redis ->getOption (\Redis::OPT_SCAN );
653
-
654
- $ cursor = null ;
655
- $ result = [];
656
- if ($ optScan === \Redis::SCAN_RETRY ) {
657
- while ($ tmpKeys = $ this ->redis ->scan ($ cursor , $ prefix . $ pattern )) {
658
- $ result = array_merge ($ result , $ tmpKeys );
659
- }
660
- } else {
661
- do {
662
- $ tmpKeys = $ this ->redis ->scan ($ cursor , $ prefix . $ pattern );
663
- $ result = is_array ($ tmpKeys ) ? array_merge ($ result , $ tmpKeys ) : $ result ;
664
- } while ($ cursor > 0 );
665
- }
666
-
667
- return $ result ;
668
- }
669
-
670
645
/**
671
646
* @param mixed[] $data
672
647
* @return string
0 commit comments