Inline metrics/scripts dependencies
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,7 +2,6 @@
|
|||||||
/book/src/img/
|
/book/src/img/
|
||||||
/book/src/tests.ok
|
/book/src/tests.ok
|
||||||
/farf/
|
/farf/
|
||||||
/metrics/scripts/lib/
|
|
||||||
/solana-release/
|
/solana-release/
|
||||||
solana-release.tar.bz2
|
solana-release.tar.bz2
|
||||||
/target/
|
/target/
|
||||||
|
@ -17,7 +17,8 @@ https://buildkite.com/solana-labs/publish-metrics-dashboard.
|
|||||||
|
|
||||||
### Modifying a Dashboard
|
### Modifying a Dashboard
|
||||||
|
|
||||||
Dashboard updates are accomplished by modifying `metrics/testnet-monitor.json`,
|
Dashboard updates are accomplished by modifying
|
||||||
|
`metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json`,
|
||||||
**manual edits made directly in Grafana will be overwritten**.
|
**manual edits made directly in Grafana will be overwritten**.
|
||||||
|
|
||||||
* Check out metrics to add at https://metrics.solana.com:8888/ in the data explorer.
|
* Check out metrics to add at https://metrics.solana.com:8888/ in the data explorer.
|
||||||
@ -31,13 +32,13 @@ Dashboard updates are accomplished by modifying `metrics/testnet-monitor.json`,
|
|||||||
`Settings` menu for the dashboard
|
`Settings` menu for the dashboard
|
||||||
3. Edit dashboard as desired
|
3. Edit dashboard as desired
|
||||||
4. Extract the JSON Model by selecting `JSON Model` in the `Settings` menu. Copy the JSON to the clipboard
|
4. Extract the JSON Model by selecting `JSON Model` in the `Settings` menu. Copy the JSON to the clipboard
|
||||||
and paste into `metrics/testnet-monitor.json`
|
and paste into `metrics/scripts/grafana-provisioning/dashboards/testnet-monitor.json`,
|
||||||
5. Delete your development dashboard: `Settings` => `Delete`
|
5. Delete your development dashboard: `Settings` => `Delete`
|
||||||
|
|
||||||
### Deploying a Dashboard Manually
|
### Deploying a Dashboard Manually
|
||||||
|
|
||||||
If you need to immediately deploy a dashboard using the contents of
|
If you need to immediately deploy a dashboard using the contents of
|
||||||
`metrics/testnet-monitor.json` in your local workspace,
|
`testnet-monitor.json` in your local workspace,
|
||||||
```
|
```
|
||||||
$ export GRAFANA_API_TOKEN="an API key from https://metrics.solana.com:3000/org/apikeys"
|
$ export GRAFANA_API_TOKEN="an API key from https://metrics.solana.com:3000/org/apikeys"
|
||||||
$ metrics/publish-metrics-dashboard.sh (edge|beta|stable)
|
$ metrics/publish-metrics-dashboard.sh (edge|beta|stable)
|
||||||
|
@ -31,14 +31,14 @@ if [[ -z $GRAFANA_API_TOKEN ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DASHBOARD_JSON=./testnet-monitor.json
|
DASHBOARD_JSON=scripts/grafana-provisioning/dashboards/testnet-monitor.json
|
||||||
if [[ ! -r $DASHBOARD_JSON ]]; then
|
if [[ ! -r $DASHBOARD_JSON ]]; then
|
||||||
echo Error: $DASHBOARD_JSON not found
|
echo Error: $DASHBOARD_JSON not found
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
./adjust-dashboard-for-channel.py "$DASHBOARD_JSON" "$CHANNEL" "$DASHBOARD_JSON".out
|
scripts/adjust-dashboard-for-channel.py "$DASHBOARD_JSON" "$CHANNEL"
|
||||||
)
|
)
|
||||||
|
|
||||||
rm -rf venv
|
rm -rf venv
|
||||||
@ -65,7 +65,7 @@ echo --- Take a backup of existing dashboard if possible
|
|||||||
echo --- Publish $DASHBOARD_JSON to $DASHBOARD
|
echo --- Publish $DASHBOARD_JSON to $DASHBOARD
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
grafcli import "$DASHBOARD_JSON".out remote/metrics
|
grafcli import "$DASHBOARD_JSON" remote/metrics
|
||||||
)
|
)
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
1
metrics/scripts/.gitignore
vendored
Normal file
1
metrics/scripts/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/lib/
|
@ -6,13 +6,12 @@
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
if len(sys.argv) != 4:
|
if len(sys.argv) != 3:
|
||||||
print('Error: Dashboard or Channel not specified')
|
print('Error: Dashboard or Channel not specified')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
dashboard_json = sys.argv[1]
|
dashboard_json = sys.argv[1]
|
||||||
channel = sys.argv[2]
|
channel = sys.argv[2]
|
||||||
output_dashboard_json = sys.argv[3]
|
|
||||||
|
|
||||||
if channel not in ['edge', 'beta', 'stable', 'local']:
|
if channel not in ['edge', 'beta', 'stable', 'local']:
|
||||||
print('Error: Unknown channel:', channel)
|
print('Error: Unknown channel:', channel)
|
||||||
@ -132,5 +131,5 @@ else:
|
|||||||
'type': 'query',
|
'type': 'query',
|
||||||
'useTags': False}]
|
'useTags': False}]
|
||||||
|
|
||||||
with open(output_dashboard_json, 'w') as write_file:
|
with open(dashboard_json, 'w') as write_file:
|
||||||
json.dump(data, write_file, indent=2)
|
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"
|
export SOLANA_METRICS_CONFIG="host=http://localhost:8086,db=testnet,u=write,p=write"
|
||||||
|
|
||||||
# shellcheck source=scripts/configure-metrics.sh
|
__configure_metrics_sh="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. || true; pwd)"/scripts/configure-metrics.sh
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. || exit 1; pwd)"/scripts/configure-metrics.sh
|
if [[ -f $__configure_metrics_sh ]]; then
|
||||||
|
# shellcheck source=scripts/configure-metrics.sh
|
||||||
echo Local metrics enabled
|
source "$__configure_metrics_sh"
|
||||||
|
fi
|
||||||
|
__configure_metrics_sh=
|
||||||
|
@ -11,10 +11,8 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if [[ ! -f grafana-provisioning/dashboards/local.json ]]; then
|
./adjust-dashboard-for-channel.py \
|
||||||
../adjust-dashboard-for-channel.py \
|
grafana-provisioning/dashboards/testnet-monitor.json local
|
||||||
../testnet-monitor.json local grafana-provisioning/dashboards/local.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
: "${INFLUXDB_IMAGE:=influxdb:1.6}"
|
: "${INFLUXDB_IMAGE:=influxdb:1.6}"
|
||||||
: "${GRAFANA_IMAGE:=solanalabs/grafana:stable}"
|
: "${GRAFANA_IMAGE:=solanalabs/grafana:stable}"
|
||||||
|
@ -26,7 +26,7 @@ cat <<EOF
|
|||||||
=========================================================================
|
=========================================================================
|
||||||
* Grafana dashboards are available at http://localhost:3000/dashboards
|
* Grafana dashboards are available at http://localhost:3000/dashboards
|
||||||
|
|
||||||
* Enable local metric collection per shell by running the command:
|
* Enable local metric collection per shell by running:
|
||||||
source $PWD/enable.sh
|
export SOLANA_METRICS_CONFIG="host=http://localhost:8086,db=testnet,u=write,p=write"
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
Reference in New Issue
Block a user