ommit timestamp for now

master
Dirk Heilig 2024-08-14 16:42:53 +02:00
parent 0dcc6e37a1
commit ae58246f57
1 changed files with 13 additions and 3 deletions

View File

@ -216,7 +216,19 @@ function output(): void
$prom .= "# $fkey in the last $fname: $count\n"; $prom .= "# $fkey in the last $fname: $count\n";
} }
} }
foreach ($data as $entry) {
$filteredData=[];
foreach($data as $entry){
$sort=$entry['labels']??[];
ksort($sort);
$sort[]=$entry['name'];
$hash=md5(json_encode($sort));
$filteredData[$hash]=$entry;
}
foreach ($filteredData as $entry) {
$labels = []; $labels = [];
if (isset($entry["labels"])) { if (isset($entry["labels"])) {
foreach ($entry["labels"] as $labelName => $labelValue) { foreach ($entry["labels"] as $labelName => $labelValue) {
@ -238,8 +250,6 @@ function output(): void
$labels . $labels .
" " . " " .
$entry["value"] . $entry["value"] .
" " .
$entry["timestamp"] .
"\n"; "\n";
} }
file_put_contents("/www/metrics/new.prom", $prom); file_put_contents("/www/metrics/new.prom", $prom);