From a80955eacbd132bfce5d589a146e8852ec4d1074 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Tue, 9 Oct 2018 10:35:01 -0700 Subject: [PATCH] Change format of data for TPS/Finality metrics in testnet automation (#1446) * Change format of data for TPS/Finality metrics in testnet automation * Revert number of nodes for testnet automation * Split python command to its own script * Fix python command line arguments --- ci/testnet-automation-json-parser.py | 7 +++++++ ci/testnet-automation.sh | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100755 ci/testnet-automation-json-parser.py diff --git a/ci/testnet-automation-json-parser.py b/ci/testnet-automation-json-parser.py new file mode 100755 index 0000000000..2ff8d5e178 --- /dev/null +++ b/ci/testnet-automation-json-parser.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +import sys, json + +data=json.load(sys.stdin) +print[\ + ([result['series'][0]['columns'][1].encode(), result['series'][0]['values'][0][1]]) \ + for result in data['results']] diff --git a/ci/testnet-automation.sh b/ci/testnet-automation.sh index 3638452f35..162c98c50b 100755 --- a/ci/testnet-automation.sh +++ b/ci/testnet-automation.sh @@ -29,38 +29,38 @@ launchTestnet() { sleep "$ITERATION_WAIT" declare q_mean_tps=' - SELECT round(mean("sum_count")) FROM ( + SELECT round(mean("sum_count")) AS "mean_tps" FROM ( SELECT sum("count") AS "sum_count" FROM "testnet-automation"."autogen"."counter-banking_stage-process_transactions" WHERE time > now() - 300s GROUP BY time(1s) )' declare q_max_tps=' - SELECT round(max("sum_count")) FROM ( + SELECT round(max("sum_count")) AS "max_tps" FROM ( SELECT sum("count") AS "sum_count" FROM "testnet-automation"."autogen"."counter-banking_stage-process_transactions" WHERE time > now() - 300s GROUP BY time(1s) )' declare q_mean_finality=' - SELECT round(mean("duration_ms")) + SELECT round(mean("duration_ms")) as "mean_finality" FROM "testnet-automation"."autogen"."leader-finality" WHERE time > now() - 300s' declare q_max_finality=' - SELECT round(max("duration_ms")) + SELECT round(max("duration_ms")) as "max_finality" FROM "testnet-automation"."autogen"."leader-finality" WHERE time > now() - 300s' declare q_99th_finality=' - SELECT round(percentile("duration_ms", 99)) + SELECT round(percentile("duration_ms", 99)) as "99th_finality" FROM "testnet-automation"."autogen"."leader-finality" WHERE time > now() - 300s' curl -G "https://metrics.solana.com:8086/query?u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}" \ --data-urlencode "db=$INFLUX_DATABASE" \ - --data-urlencode "q=$q_mean_tps;$q_max_tps;$q_mean_finality;$q_max_finality;$q_99th_finality" \ - >>TPS"$nodeCount".log + --data-urlencode "q=$q_mean_tps;$q_max_tps;$q_mean_finality;$q_max_finality;$q_99th_finality" | + python ci/testnet-automation-json-parser.py >>TPS"$nodeCount".log upload_ci_artifact TPS"$nodeCount".log }