Skip to content

Commit

Permalink
Add support for Lodestar beaconcha.in monitoring (eth-educators#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Mar 22, 2023
1 parent 1af5c11 commit 5b49cdd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CL_MIN_PEER_COUNT=
# Maximum active peers for EL.
EL_MAX_PEER_COUNT=

# Beaconcha.in API key for sending client stats. Automatic for Lighthouse and Teku, or with prysm-stats.yml / nimbus-stats.yml
# Beaconcha.in API key for sending client stats. Automatic for Lodestar, Lighthouse, and Teku, or with prysm-stats.yml / nimbus-stats.yml
# Specify as just the API key as found at https://beaconcha.in/user/settings#api, and give the machine name separately
BEACON_STATS_API=
BEACON_STATS_MACHINE=
Expand Down
2 changes: 2 additions & 0 deletions lodestar-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
- JWT_SECRET=${JWT_SECRET}
- MEV_BOOST=${MEV_BOOST}
- MEV_NODE=${MEV_NODE}
- BEACON_STATS_API=${BEACON_STATS_API}
- BEACON_STATS_MACHINE=${BEACON_STATS_MACHINE}
- CL_EXTRAS=${CL_EXTRAS:-}
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
ports:
Expand Down
2 changes: 2 additions & 0 deletions lodestar-vc-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ services:
user: lsvalidator
environment:
- MEV_BOOST=${MEV_BOOST}
- BEACON_STATS_API=${BEACON_STATS_API}
- BEACON_STATS_MACHINE=${BEACON_STATS_MACHINE}
- DOPPELGANGER=${DOPPELGANGER}
- VC_EXTRAS=${VC_EXTRAS:-}
volumes:
Expand Down
4 changes: 4 additions & 0 deletions lodestar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
- JWT_SECRET=${JWT_SECRET}
- MEV_BOOST=${MEV_BOOST}
- MEV_NODE=${MEV_NODE}
- BEACON_STATS_API=${BEACON_STATS_API}
- BEACON_STATS_MACHINE=${BEACON_STATS_MACHINE}
- CL_EXTRAS=${CL_EXTRAS:-}
- ARCHIVE_NODE=${ARCHIVE_NODE:-}
ports:
Expand Down Expand Up @@ -73,6 +75,8 @@ services:
user: lsvalidator
environment:
- MEV_BOOST=${MEV_BOOST}
- BEACON_STATS_API=${BEACON_STATS_API}
- BEACON_STATS_MACHINE=${BEACON_STATS_MACHINE}
- DOPPELGANGER=${DOPPELGANGER}
- VC_EXTRAS=${VC_EXTRAS:-}
volumes:
Expand Down
10 changes: 9 additions & 1 deletion lodestar/docker-entrypoint-vc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ else
__mev_boost=""
fi

# Check whether we should send stats to beaconcha.in
if [ -n "${BEACON_STATS_API}" ]; then
__beacon_stats="--monitoring.endpoint https://beaconcha.in/api/v1/client/metrics?apikey=${BEACON_STATS_API}&machine=${BEACON_STATS_MACHINE}"
echo "Beacon stats API enabled"
else
__beacon_stats=""
fi

# Check whether we should enable doppelganger protection
if [ "${DOPPELGANGER}" = "true" ]; then
__doppel="--doppelgangerProtectionEnabled"
Expand All @@ -24,4 +32,4 @@ fi

# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${__mev_boost} ${__doppel} ${VC_EXTRAS}
exec "$@" ${__mev_boost} ${__beacon_stats} ${__doppel} ${VC_EXTRAS}
10 changes: 9 additions & 1 deletion lodestar/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ else
__mev_boost=""
fi

# Check whether we should send stats to beaconcha.in
if [ -n "${BEACON_STATS_API}" ]; then
__beacon_stats="--monitoring.endpoint https://beaconcha.in/api/v1/client/metrics?apikey=${BEACON_STATS_API}&machine=${BEACON_STATS_MACHINE}"
echo "Beacon stats API enabled"
else
__beacon_stats=""
fi

# Check whether we should rapid sync
if [ -n "${RAPID_SYNC_URL}" ]; then
if [ "${ARCHIVE_NODE}" = "true" ]; then
Expand All @@ -46,4 +54,4 @@ fi

# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${__mev_boost} ${__rapid_sync} ${CL_EXTRAS}
exec "$@" ${__mev_boost} ${__beacon_stats} ${__rapid_sync} ${CL_EXTRAS}

0 comments on commit 5b49cdd

Please sign in to comment.