Skip to content

Commit

Permalink
Merge pull request #108 from ethpandaops/fix/execution-web3-client-ve…
Browse files Browse the repository at this point in the history
…rsion

fix(exe): Reset web3_client_version when version changes
  • Loading branch information
samcm authored Aug 14, 2024
2 parents 8a207d6 + 01a4acb commit 5840e44
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions pkg/exporter/execution/jobs/web3.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import (

// Web3 exposes metrics defined by the Web3 module.
type Web3 struct {
client *ethclient.Client
api api.ExecutionClient
ethRPCClient *ethrpc.EthRPC
log logrus.FieldLogger
ClientVersion prometheus.GaugeVec
client *ethclient.Client
api api.ExecutionClient
ethRPCClient *ethrpc.EthRPC
log logrus.FieldLogger
ClientVersion prometheus.GaugeVec
previousVersion string
}

const (
Expand Down Expand Up @@ -76,6 +77,12 @@ func (w *Web3) tick(ctx context.Context) {
if err != nil {
w.log.WithError(err).Error("Failed to get node info")
} else {
w.ClientVersion.WithLabelValues(clientVersion).Set(1)
if w.previousVersion != clientVersion {
w.ClientVersion.Reset()

w.ClientVersion.WithLabelValues(clientVersion).Set(1)
}

w.previousVersion = clientVersion
}
}

0 comments on commit 5840e44

Please sign in to comment.