fix Grafana dashboards (#1006)

* fix Grafana dashboards

and refactor a couple of scripts

* start.sh: allow running standalone script
This commit is contained in:
Ștefan Talpalaru 2020-05-11 20:35:53 +02:00 committed by GitHub
parent fb2e0ddbec
commit 2d78523423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 32 deletions

View File

@ -117,7 +117,7 @@ $(TOOLS): | build deps
clean_eth2_network_simulation_files:
rm -rf tests/simulation/{data,validators}
eth2_network_simulation: | build deps clean_eth2_network_simulation_files process_dashboard
eth2_network_simulation: | build deps clean_eth2_network_simulation_files
+ GIT_ROOT="$$PWD" NIMFLAGS="$(NIMFLAGS)" LOG_LEVEL="$(LOG_LEVEL)" tests/simulation/start.sh
clean-testnet0:

View File

@ -126,7 +126,7 @@ else
fi
NETWORK_NIM_FLAGS=$(scripts/load-testnet-nim-flags.sh ${NETWORK})
$MAKE LOG_LEVEL="${LOG_LEVEL}" NIMFLAGS="-d:insecure -d:testnet_servers_image ${NETWORK_NIM_FLAGS}" beacon_node
$MAKE -j2 LOG_LEVEL="${LOG_LEVEL}" NIMFLAGS="-d:insecure -d:testnet_servers_image ${NETWORK_NIM_FLAGS}" beacon_node process_dashboard
./build/beacon_node makeDeposits \
--quickstart-deposits=${QUICKSTART_VALIDATORS} \
@ -165,11 +165,7 @@ EOF
done
# use the exported Grafana dashboard for a single node to create one for all nodes
PROCESS_DASHBOARD_BIN="build/process_dashboard"
if [[ ! -f "$PROCESS_DASHBOARD_BIN" ]]; then
$MAKE process_dashboard
fi
"${PROCESS_DASHBOARD_BIN}" \
./build/process_dashboard \
--nodes=${NUM_NODES} \
--in="tests/simulation/beacon-chain-sim-node0-Grafana-dashboard.json" \
--out="${DATA_DIR}/local-testnet-all-nodes-Grafana-dashboard.json"

View File

@ -43,9 +43,10 @@ for nodeNum in 0 .. (nodes - 1):
panel["title"] = %* replace(panel["title"].getStr(), "#0", "#" & $nodeNum)
panel["id"] = %* (panelIndex + (nodeNum * numPanels))
panel["gridPos"]["y"] = %* (panel["gridPos"]["y"].getInt() + (nodeNum * gridHeight))
var targets = panel["targets"]
for target in targets.mitems:
target["expr"] = %* replace(target["expr"].getStr(), "{node=\"0\"}", "{node=\"" & $nodeNum & "\"}")
if panel.hasKey("targets"):
var targets = panel["targets"]
for target in targets.mitems:
target["expr"] = %* replace(target["expr"].getStr(), "{node=\"0\"}", "{node=\"" & $nodeNum & "\"}")
outputData["panels"].add(panel)
panelIndex.inc()

View File

@ -12,7 +12,7 @@ mkdir -p "$VALIDATORS_DIR"
cd "$GIT_ROOT"
CUSTOM_NIMFLAGS="${NIMFLAGS} -d:useSysAsserts -d:chronicles_sinks:textlines,json[file] -d:const_preset=mainnet"
CUSTOM_NIMFLAGS="${NIMFLAGS} -d:useSysAsserts -d:chronicles_sinks:textlines,json[file] -d:const_preset=mainnet -d:insecure"
# Run with "SLOTS_PER_EPOCH=8 ./start.sh" to change these
DEFS=""
@ -110,19 +110,9 @@ if [[ "$USE_TMUX" != "no" ]]; then
$TMUX select-window -t "${TMUX_SESSION_NAME}:sim"
fi
build_beacon_node () {
OUTPUT_BIN=$1; shift
PARAMS="$CUSTOM_NIMFLAGS $DEFS $@"
echo "Building $OUTPUT_BIN ($PARAMS)"
$MAKE NIMFLAGS="-o:$OUTPUT_BIN $PARAMS" LOG_LEVEL="${LOG_LEVEL:-DEBUG}" beacon_node
}
build_beacon_node $BEACON_NODE_BIN
$MAKE -j3 NIMFLAGS="$CUSTOM_NIMFLAGS $DEFS" LOG_LEVEL="${LOG_LEVEL:-DEBUG}" beacon_node process_dashboard deposit_contract
if [ ! -f "${LAST_VALIDATOR}" ]; then
echo Building "${DEPLOY_DEPOSIT_CONTRACT_BIN}"
$MAKE NIMFLAGS="-o:\"$DEPLOY_DEPOSIT_CONTRACT_BIN\" $CUSTOM_NIMFLAGS $DEFS" deposit_contract
if [ "$WEB3_ARG" != "" ]; then
echo Deploying the validator deposit contract...
DEPOSIT_CONTRACT_ADDRESS=$($DEPLOY_DEPOSIT_CONTRACT_BIN deploy $WEB3_ARG)
@ -174,15 +164,9 @@ if [ -f "${MASTER_NODE_ADDRESS_FILE}" ]; then
rm "${MASTER_NODE_ADDRESS_FILE}"
fi
PROCESS_DASHBOARD_BIN="build/process_dashboard"
if [[ ! -f "$PROCESS_DASHBOARD_BIN" ]]; then
$MAKE NIMFLAGS="$CUSTOM_NIMFLAGS" process_dashboard
fi
# use the exported Grafana dashboard for a single node to create one for all nodes
echo Creating grafana dashboards...
"${PROCESS_DASHBOARD_BIN}" \
./build/process_dashboard \
--nodes=${TOTAL_NODES} \
--in="${SIM_ROOT}/beacon-chain-sim-node0-Grafana-dashboard.json" \
--out="${SIM_ROOT}/beacon-chain-sim-all-nodes-Grafana-dashboard.json"

View File

@ -30,8 +30,8 @@ METRICS_DIR="${SIM_ROOT}/prometheus"
VALIDATORS_DIR="${SIM_ROOT}/validators"
SNAPSHOT_FILE="${SIMULATION_DIR}/state_snapshot.ssz"
NETWORK_BOOTSTRAP_FILE="${SIMULATION_DIR}/bootstrap_nodes.txt"
BEACON_NODE_BIN="${SIMULATION_DIR}/beacon_node"
DEPLOY_DEPOSIT_CONTRACT_BIN="${SIMULATION_DIR}/deploy_deposit_contract"
BEACON_NODE_BIN="${GIT_ROOT}/build/beacon_node"
DEPLOY_DEPOSIT_CONTRACT_BIN="${GIT_ROOT}/build/deposit_contract"
MASTER_NODE_ADDRESS_FILE="${SIMULATION_DIR}/node-${MASTER_NODE}/beacon_node.address"
BASE_P2P_PORT=30000

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit f730557baa415cfe689ac28f322dedf3deb99a2e
Subproject commit c67b67ddbdefd0e291985ea4448f63a4bd4b328a