Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(exe): Reset web3_client_version when version changes #108

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
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
}
}
Loading