limit validator balance metric label values (#2719)

This commit is contained in:
Ștefan Talpalaru 2021-07-14 08:22:03 +02:00 committed by GitHub
parent 3f9c1fdf4e
commit 840935ddc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -584,10 +584,10 @@ proc updateValidatorMetrics*(node: BeaconNode) =
when defined(metrics):
# Technically, this only needs to be done on epoch transitions and if there's
# a reorg that spans an epoch transition, but it's easier to implement this
# way for now..
# way for now.
# We'll limit labelled metrics to the first 64, so that we don't overload
# prom
# Prometheus.
var total: Gwei
var i = 0
@ -608,8 +608,8 @@ proc updateValidatorMetrics*(node: BeaconNode) =
if i < 64:
attached_validator_balance.set(
balance.toGaugeValue, labelValues = [shortLog(v.pubkey)])
else:
inc i
inc i
total += balance
node.attachedValidatorBalanceTotal = total