Merge pull request #316 from maticnetwork/feature-ethstats-arbitrary

Added arbitray data Ethstats
This commit is contained in:
Sandeep Sreenath 2022-04-20 15:31:18 +05:30 committed by GitHub
commit 30ad2b5718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,6 +86,20 @@ type fullNodeBackend interface {
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
}
type EthstatsDataType struct {
kv map[string]string
}
// Function to add data to EthstatsData
func (e *EthstatsDataType) AddKV(key, val string) {
e.kv[key] = val
}
// Arbitrary Data that can be included
var EthstatsData = &EthstatsDataType{
kv: make(map[string]string),
}
// Service implements an Ethereum netstats reporting daemon that pushes local
// chain statistics up to a monitoring server.
type Service struct {
@ -476,6 +490,7 @@ type nodeInfo struct {
OsVer string `json:"os_v"`
Client string `json:"client"`
History bool `json:"canUpdateHistory"`
Data map[string]string `json:"data"`
}
// authMsg is the authentication infos needed to login to a monitoring server.
@ -513,6 +528,7 @@ func (s *Service) login(conn *connWrapper) error {
OsVer: runtime.GOARCH,
Client: "0.1.1",
History: true,
Data: EthstatsData.kv,
},
Secret: s.pass,
}