refactor: Update all applications to store metrics (#7853)

* Update all applications to store metrics

* fix db schema

* Add glue test
This commit is contained in:
Tony Murray
2017-12-06 16:13:10 -06:00
committed by Neil Lathwood
parent 0dd3ec25d3
commit b620692426
44 changed files with 181 additions and 74 deletions

View File

@@ -30,6 +30,8 @@ $rrd_def = RrdDefinition::make()
->addDataset('rxpci', 'GAUGE', 0)
->addDataset('txpci', 'GAUGE', 0);
$sm_total = 0;
$metrics = array();
foreach ($gpuArray as $index => $gpu) {
$stats = explode(",", $gpu);
$sm_total += $stats[3];
@@ -58,10 +60,11 @@ foreach ($gpuArray as $index => $gpu) {
'rxpci' => $rxpci,
'txpci' => $txpci
);
$metrics[$index] = $fields;
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
data_update($device, 'app', $tags, $fields);
}
$sm_average = ($sm_total ? ($sm_total / count($gpuArray)) : 0);
update_application($app, $gpus, $sm_average);
update_application($app, $gpus, $metrics, $sm_average);