Inline metrics/scripts dependencies
This commit is contained in:
1
metrics/scripts/.gitignore
vendored
Normal file
1
metrics/scripts/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/lib/
|
135
metrics/scripts/adjust-dashboard-for-channel.py
Executable file
135
metrics/scripts/adjust-dashboard-for-channel.py
Executable file
@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Adjusts the testnet monitor dashboard for the specified release channel
|
||||
#
|
||||
|
||||
import sys
|
||||
import json
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print('Error: Dashboard or Channel not specified')
|
||||
sys.exit(1)
|
||||
|
||||
dashboard_json = sys.argv[1]
|
||||
channel = sys.argv[2]
|
||||
|
||||
if channel not in ['edge', 'beta', 'stable', 'local']:
|
||||
print('Error: Unknown channel:', channel)
|
||||
sys.exit(2)
|
||||
|
||||
with open(dashboard_json, 'r') as read_file:
|
||||
data = json.load(read_file)
|
||||
|
||||
if channel == 'local':
|
||||
data['title'] = 'Local Testnet Monitor'
|
||||
data['uid'] = 'local'
|
||||
data['links'] = []
|
||||
data['templating']['list'] = [{'current': {'text': '$datasource',
|
||||
'value': '$datasource'},
|
||||
'hide': 1,
|
||||
'label': 'Data Source',
|
||||
'name': 'datasource',
|
||||
'options': [],
|
||||
'query': 'influxdb',
|
||||
'refresh': 1,
|
||||
'regex': '',
|
||||
'type': 'datasource'},
|
||||
{'allValue': None,
|
||||
'current': {'text': 'testnet',
|
||||
'value': 'testnet'},
|
||||
'hide': 1,
|
||||
'includeAll': False,
|
||||
'label': 'Testnet',
|
||||
'multi': False,
|
||||
'name': 'testnet',
|
||||
'options': [{'selected': True,
|
||||
'text': 'testnet',
|
||||
'value': 'testnet'}],
|
||||
'query': 'testnet',
|
||||
'type': 'custom'}]
|
||||
|
||||
elif channel == 'stable':
|
||||
# Stable dashboard only allows the user to select between the stable
|
||||
# testnet databases
|
||||
data['title'] = 'Testnet Monitor'
|
||||
data['uid'] = 'testnet'
|
||||
data['templating']['list'] = [{'current': {'text': '$datasource',
|
||||
'value': '$datasource'},
|
||||
'hide': 1,
|
||||
'label': 'Data Source',
|
||||
'name': 'datasource',
|
||||
'options': [],
|
||||
'query': 'influxdb',
|
||||
'refresh': 1,
|
||||
'regex': '',
|
||||
'type': 'datasource'},
|
||||
{'allValue': None,
|
||||
'current': {'text': 'testnet',
|
||||
'value': 'testnet'},
|
||||
'hide': 1,
|
||||
'includeAll': False,
|
||||
'label': 'Testnet',
|
||||
'multi': False,
|
||||
'name': 'testnet',
|
||||
'options': [{'selected': False,
|
||||
'text': 'testnet',
|
||||
'value': 'testnet'},
|
||||
{'selected': True,
|
||||
'text': 'testnet-perf',
|
||||
'value': 'testnet-perf'}],
|
||||
'query': 'testnet,testnet-perf',
|
||||
'type': 'custom'}]
|
||||
else:
|
||||
# Non-stable dashboard only allows the user to select between all testnet
|
||||
# databases
|
||||
data['title'] = 'Testnet Monitor ({})'.format(channel)
|
||||
data['uid'] = 'testnet-' + channel
|
||||
data['templating']['list'] = [{'current': {'text': '$datasource',
|
||||
'value': '$datasource'},
|
||||
'hide': 1,
|
||||
'label': 'Data Source',
|
||||
'name': 'datasource',
|
||||
'options': [],
|
||||
'query': 'influxdb',
|
||||
'refresh': 1,
|
||||
'regex': '',
|
||||
'type': 'datasource'},
|
||||
{'allValue': ".*",
|
||||
'current': {'text': 'testnet',
|
||||
'value': 'testnet'},
|
||||
'datasource': '$datasource',
|
||||
'hide': 1,
|
||||
'includeAll': False,
|
||||
'label': 'Testnet',
|
||||
'multi': False,
|
||||
'name': 'testnet',
|
||||
'options': [],
|
||||
'query': 'show databases',
|
||||
'refresh': 1,
|
||||
'regex': 'testnet.*',
|
||||
'sort': 1,
|
||||
'tagValuesQuery': '',
|
||||
'tags': [],
|
||||
'tagsQuery': '',
|
||||
'type': 'query',
|
||||
'useTags': False},
|
||||
{'allValue': ".*",
|
||||
'datasource': '$datasource',
|
||||
'hide': 0,
|
||||
'includeAll': True,
|
||||
'label': 'HostID',
|
||||
'multi': False,
|
||||
'name': 'hostid',
|
||||
'options': [],
|
||||
'query': 'SELECT DISTINCT(\"host_id\") FROM \"$testnet\".\"autogen\".\"counter-fullnode-new\" ',
|
||||
'refresh': 2,
|
||||
'regex': '',
|
||||
'sort': 1,
|
||||
'tagValuesQuery': '',
|
||||
'tags': [],
|
||||
'tagsQuery': '',
|
||||
'type': 'query',
|
||||
'useTags': False}]
|
||||
|
||||
with open(dashboard_json, 'w') as write_file:
|
||||
json.dump(data, write_file, indent=2)
|
@ -2,7 +2,9 @@
|
||||
|
||||
export SOLANA_METRICS_CONFIG="host=http://localhost:8086,db=testnet,u=write,p=write"
|
||||
|
||||
# shellcheck source=scripts/configure-metrics.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. || exit 1; pwd)"/scripts/configure-metrics.sh
|
||||
|
||||
echo Local metrics enabled
|
||||
__configure_metrics_sh="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. || true; pwd)"/scripts/configure-metrics.sh
|
||||
if [[ -f $__configure_metrics_sh ]]; then
|
||||
# shellcheck source=scripts/configure-metrics.sh
|
||||
source "$__configure_metrics_sh"
|
||||
fi
|
||||
__configure_metrics_sh=
|
||||
|
8103
metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json
Normal file
8103
metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,10 +11,8 @@ cd "$(dirname "$0")"
|
||||
|
||||
set -x
|
||||
|
||||
if [[ ! -f grafana-provisioning/dashboards/local.json ]]; then
|
||||
../adjust-dashboard-for-channel.py \
|
||||
../testnet-monitor.json local grafana-provisioning/dashboards/local.json
|
||||
fi
|
||||
./adjust-dashboard-for-channel.py \
|
||||
grafana-provisioning/dashboards/testnet-monitor.json local
|
||||
|
||||
: "${INFLUXDB_IMAGE:=influxdb:1.6}"
|
||||
: "${GRAFANA_IMAGE:=solanalabs/grafana:stable}"
|
||||
|
@ -26,7 +26,7 @@ cat <<EOF
|
||||
=========================================================================
|
||||
* Grafana dashboards are available at http://localhost:3000/dashboards
|
||||
|
||||
* Enable local metric collection per shell by running the command:
|
||||
source $PWD/enable.sh
|
||||
* Enable local metric collection per shell by running:
|
||||
export SOLANA_METRICS_CONFIG="host=http://localhost:8086,db=testnet,u=write,p=write"
|
||||
|
||||
EOF
|
||||
|
Reference in New Issue
Block a user