mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 09:19:44 +00:00
*: move metric neogo_version
out of pkg/network
Close #3682 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
dc2d22110f
commit
ebb71497a5
4 changed files with 24 additions and 16 deletions
23
cli/server/metrics.go
Normal file
23
cli/server/metrics.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var neogoVersion = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Help: "NeoGo version",
|
||||
Name: "version",
|
||||
Namespace: "neogo",
|
||||
},
|
||||
[]string{"version"})
|
||||
|
||||
func setNeoGoVersion(nodeVer string) {
|
||||
neogoVersion.WithLabelValues(nodeVer).Add(1)
|
||||
}
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(
|
||||
neogoVersion,
|
||||
)
|
||||
}
|
|
@ -506,7 +506,7 @@ func startServer(ctx *cli.Context) error {
|
|||
errChan := make(chan error)
|
||||
rpcServer := rpcsrv.New(chain, cfg.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
|
||||
serv.AddService(rpcServer)
|
||||
|
||||
setNeoGoVersion(config.Version)
|
||||
serv.Start()
|
||||
if !cfg.ApplicationConfiguration.RPC.StartWhenSynchronized {
|
||||
// Run RPC server in a separate routine. This is necessary to avoid a potential
|
||||
|
|
|
@ -24,15 +24,6 @@ var (
|
|||
Namespace: "neogo",
|
||||
},
|
||||
)
|
||||
|
||||
neogoVersion = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Help: "NeoGo version",
|
||||
Name: "version",
|
||||
Namespace: "neogo",
|
||||
},
|
||||
[]string{"version"})
|
||||
|
||||
serverID = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Help: "network server ID",
|
||||
|
@ -72,7 +63,6 @@ func init() {
|
|||
prometheus.MustRegister(
|
||||
estimatedNetworkSize,
|
||||
peersConnected,
|
||||
neogoVersion,
|
||||
serverID,
|
||||
poolCount,
|
||||
blockQueueLength,
|
||||
|
@ -111,10 +101,6 @@ func updatePeersConnectedMetric(pConnected int) {
|
|||
peersConnected.Set(float64(pConnected))
|
||||
}
|
||||
|
||||
func setNeoGoVersion(nodeVer string) {
|
||||
neogoVersion.WithLabelValues(nodeVer).Add(1)
|
||||
}
|
||||
|
||||
func setSeverID(id string) {
|
||||
serverID.WithLabelValues(id).Add(1)
|
||||
}
|
||||
|
|
|
@ -318,7 +318,6 @@ func (s *Server) Start() {
|
|||
for _, tr := range s.transports {
|
||||
go tr.Accept()
|
||||
}
|
||||
setNeoGoVersion(config.Version)
|
||||
setSeverID(strconv.FormatUint(uint64(s.id), 10))
|
||||
go s.run()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue