fix: 修复Prometheus使用redis打点,改变label导致收集报错的问题

This commit is contained in:
逍遥 2020-07-03 17:19:45 +08:00
parent 6402d179f6
commit bd99a62afc

View File

@ -284,7 +284,7 @@ LUA
if ($d['b'] == 'sum') { if ($d['b'] == 'sum') {
continue; continue;
} }
if (count($d['labelValues']) != count($histogram['labelNames'])) { if (count($d['labelValues']) !== count($histogram['labelNames'])) {
continue; continue;
} }
$allLabelValues[] = $d['labelValues']; $allLabelValues[] = $d['labelValues'];
@ -348,7 +348,7 @@ LUA
unset($raw['__meta']); unset($raw['__meta']);
$gauge['samples'] = []; $gauge['samples'] = [];
foreach ($raw as $k => $value) { foreach ($raw as $k => $value) {
if (count($gauge['labelNames']) != count(json_decode($k, true))) { if (count($gauge['labelNames']) !== count(json_decode($k, true))) {
continue; continue;
} }
$gauge['samples'][] = [ $gauge['samples'][] = [
@ -377,7 +377,7 @@ LUA
unset($raw['__meta']); unset($raw['__meta']);
$counter['samples'] = []; $counter['samples'] = [];
foreach ($raw as $k => $value) { foreach ($raw as $k => $value) {
if (count($counter['labelNames']) != count(json_decode($k, true))) { if (count($counter['labelNames']) !== count(json_decode($k, true))) {
continue; continue;
} }
$counter['samples'][] = [ $counter['samples'][] = [