Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion app/eth2wrap/eth2wrap_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/eth2wrap/genwrap/genwrap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions app/eth2wrap/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions app/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ var (
Help: "Constant gauge with label set to the node version of the upstream beacon node",
}, []string{"version"})

beaconNodePeerIDGauge = promauto.NewResetGaugeVec(prometheus.GaugeOpts{
Namespace: "app",
Subsystem: "beacon_node",
Name: "peer_id",
Help: "Constant gauge with label set to the peer_id of the upstream beacon node",
}, []string{"peer_id"})

thresholdGauge = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "cluster",
Name: "threshold",
Expand Down
15 changes: 15 additions & 0 deletions app/monitoringapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,19 @@ func beaconNodeVersionMetric(ctx context.Context, eth2Cl eth2wrap.Client, clock
eth2wrap.CheckBeaconNodeVersion(ctx, version)
}

setNodePeerID := func() {
response, err := eth2Cl.NodeIdentity(ctx, &eth2api.NodeIdentityOpts{})
if err != nil {
log.Error(ctx, "Failed to fetch beacon node identity. Check beacon node connectivity and API availability", err)
return
}

peerID := response.Data.PeerID

beaconNodePeerIDGauge.Reset()
beaconNodePeerIDGauge.WithLabelValues(peerID).Set(1)
}

go func() {
onStartup := make(chan struct{}, 1)
onStartup <- struct{}{}
Expand All @@ -294,8 +307,10 @@ func beaconNodeVersionMetric(ctx context.Context, eth2Cl eth2wrap.Client, clock
select {
case <-onStartup:
setNodeVersion()
setNodePeerID()
case <-nodeVersionTicker.Chan():
setNodeVersion()
setNodePeerID()
case <-ctx.Done():
return
}
Expand Down
Loading
Loading