From 5d065133eff681008dfcc7695853e29d237a9609 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sat, 21 Jul 2018 23:15:36 -0700 Subject: [PATCH] Add data point for testnet startup and shutdown --- .buildkite/hooks/post-command | 9 ++------- ci/metrics_write_datapoint.sh | 16 ++++++++++++++++ ci/testnet-deploy.sh | 7 +++++++ 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 ci/metrics_write_datapoint.sh diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command index 9babfaf66..919df6c98 100644 --- a/.buildkite/hooks/post-command +++ b/.buildkite/hooks/post-command @@ -40,11 +40,6 @@ else point_fields="${point_fields// /\\ }" # Escape spaces point="job_stats,$point_tags $point_fields" - echo "Influx data point: $point" - if [[ -n $INFLUX_USERNAME && -n $INFLUX_PASSWORD ]]; then - echo "https://metrics.solana.com:8086/write?db=ci&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}" \ - | xargs curl -XPOST --data-binary "$point" - else - echo Influx user credentials not found - fi + + ci/metrics_write_datapoint.sh "$point" fi diff --git a/ci/metrics_write_datapoint.sh b/ci/metrics_write_datapoint.sh new file mode 100755 index 000000000..d7fc3c58e --- /dev/null +++ b/ci/metrics_write_datapoint.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +point=$1 +if [[ -z $point ]]; then + echo "Data point not specified" + exit 1 +fi + +echo "Influx data point: $point" +if [[ -z $INFLUX_DATABASE || -z $INFLUX_USERNAME || -z $INFLUX_PASSWORD ]]; then + echo Influx user credentials not found + exit 0 +fi + +echo "https://metrics.solana.com:8086/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}" \ + | xargs curl -XPOST --data-binary "$point" diff --git a/ci/testnet-deploy.sh b/ci/testnet-deploy.sh index f2ddd3b83..0987d005a 100755 --- a/ci/testnet-deploy.sh +++ b/ci/testnet-deploy.sh @@ -118,6 +118,10 @@ if ! $ROLLING_UPDATE; then wait fi +# Add "network stopping" datapoint +netName=${SOLANA_NET_URL%testnet.solana.com} +netName=${netName:0:8} +ci/metrics_write_datapoint.sh "testnet-deploy,name=\"$netName\" stop=1" client_run() { declare message=$1 @@ -235,4 +239,7 @@ client_run \ tail /tmp/solana.log; \ " +# Add "network started" datapoint +ci/metrics_write_datapoint.sh "testnet-deploy,name=\"$netName\" start=1" + exit 0