Skip to content

Commit

Permalink
Add version to prometheus metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak committed Oct 31, 2023
1 parent 7aba064 commit 4d437aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions node/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,12 @@ func makeSyncMetrics(syncReader sync.Reader, bcReader blockchain.Reader) sync.Ev
},
}
}

func makeJunoMetrics(version string) {
prometheus.MustRegister(prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "juno",
Name: "info",
Help: "Information about the Juno binary",
ConstLabels: prometheus.Labels{"version": version},
}))
}
1 change: 1 addition & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func New(cfg *Config, version string) (*Node, error) { //nolint:gocyclo,funlen
services = append(services, makeRPCOverWebsocket(cfg.WebsocketHost, cfg.WebsocketPort, rpcServers, log, cfg.Metrics))
}
if cfg.Metrics {
makeJunoMetrics(version)
database.WithListener(makeDBMetrics())
rpcMetrics, legacyRPCMetrics := makeRPCMetrics(path, legacyPath)
jsonrpcServer.WithListener(rpcMetrics)
Expand Down

0 comments on commit 4d437aa

Please sign in to comment.