diff --git a/pkg/clients/tendermint/types.go b/pkg/clients/tendermint/types.go index beaf65f..03dda46 100644 --- a/pkg/clients/tendermint/types.go +++ b/pkg/clients/tendermint/types.go @@ -14,6 +14,7 @@ type StatusResult struct { type NodeInfo struct { Moniker string `json:"moniker"` + Version string `json:"version"` } type SyncInfo struct { diff --git a/pkg/metrics/manager.go b/pkg/metrics/manager.go index 827032b..52ed259 100644 --- a/pkg/metrics/manager.go +++ b/pkg/metrics/manager.go @@ -48,6 +48,22 @@ func NewManager(config *configPkg.Config) *Manager { []string{"node"}, ), + MetricNameMoniker: prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: constants.MetricsPrefix + "moniker", + Help: "Node moniker, always 1", + }, + []string{"node", "moniker"}, + ), + + MetricNameTendermintVersion: prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: constants.MetricsPrefix + "tendermint_version", + Help: "Tendermint/CometBFT version, always 1", + }, + []string{"node", "version"}, + ), + MetricNameRemoteVersion: prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: constants.MetricsPrefix + "remote_version", diff --git a/pkg/metrics/types.go b/pkg/metrics/types.go index 3b9aac6..70634b6 100644 --- a/pkg/metrics/types.go +++ b/pkg/metrics/types.go @@ -6,6 +6,8 @@ const ( MetricNameCosmovisorVersion = "cosmovisor_version" MetricNameCatchingUp = "catching_up" MetricNameTimeSinceLatestBlock = "time_since_latest_block" + MetricNameMoniker = "Moniker" + MetricNameTendermintVersion = "tendermint_version" MetricNameVotingPower = "voting_power" MetricNameRemoteVersion = "remote_version" MetricNameLocalVersion = "local_version" diff --git a/pkg/queriers/node_stats/querier.go b/pkg/queriers/node_stats/querier.go index bd15db8..beac3db 100644 --- a/pkg/queriers/node_stats/querier.go +++ b/pkg/queriers/node_stats/querier.go @@ -48,6 +48,16 @@ func (n *Querier) Get() ([]metrics.MetricInfo, []query_info.QueryInfo) { Labels: map[string]string{}, Value: time.Since(status.Result.SyncInfo.LatestBlockTime).Seconds(), }, + { + MetricName: metrics.MetricNameMoniker, + Labels: map[string]string{"moniker": status.Result.NodeInfo.Moniker}, + Value: 1, + }, + { + MetricName: metrics.MetricNameTendermintVersion, + Labels: map[string]string{"version": status.Result.NodeInfo.Version}, + Value: 1, + }, } if value, err := utils.StringToFloat64(status.Result.ValidatorInfo.VotingPower); err != nil {