diff --git a/cmd/kuji-cosmos-exporter/kuji.go b/cmd/kuji-cosmos-exporter/kuji.go index 8bd403a..7a1963b 100644 --- a/cmd/kuji-cosmos-exporter/kuji.go +++ b/cmd/kuji-cosmos-exporter/kuji.go @@ -33,7 +33,7 @@ func NewKujiMetrics(reg prometheus.Registerer, config *exporter.ServiceConfig) * Help: "Vote miss count", ConstLabels: config.ConstLabels, }, - []string{"type"}, + []string{"type", "validator"}, ), } @@ -65,7 +65,7 @@ func getKujiMetrics(wg *sync.WaitGroup, sublogger *zerolog.Logger, metrics *Kuji missCount := float64(response.MissCounter) - metrics.votePenaltyCount.WithLabelValues("miss").Add(missCount) + metrics.votePenaltyCount.WithLabelValues("miss", validatorAddress.String()).Add(missCount) }() } diff --git a/cmd/sei-cosmos-exporter/sei.go b/cmd/sei-cosmos-exporter/sei.go index 9e2bb5a..a0eb52f 100644 --- a/cmd/sei-cosmos-exporter/sei.go +++ b/cmd/sei-cosmos-exporter/sei.go @@ -16,11 +16,13 @@ import ( oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types" ) -type votePenaltyCounter struct { - MissCount string `json:"miss_count"` - AbstainCount string `json:"abstain_count"` - SuccessCount string `json:"success_count"` -} +/* + type votePenaltyCounter struct { + MissCount string `json:"miss_count"` + AbstainCount string `json:"abstain_count"` + SuccessCount string `json:"success_count"` + } +*/ type SeiMetrics struct { votePenaltyCount *prometheus.CounterVec } @@ -29,11 +31,11 @@ func NewSeiMetrics(reg prometheus.Registerer, config *exporter.ServiceConfig) *S m := &SeiMetrics{ votePenaltyCount: prometheus.NewCounterVec( prometheus.CounterOpts{ - Name: "cosmos_oracle_vote_penalty_count", + Name: "cosmos_sei_oracle_vote_penalty_count", Help: "Vote penalty miss count", ConstLabels: config.ConstLabels, }, - []string{"type"}, + []string{"type", "validator"}, ), } @@ -67,9 +69,9 @@ func getSeiMetrics(wg *sync.WaitGroup, sublogger *zerolog.Logger, metrics *SeiMe abstainCount := float64(response.VotePenaltyCounter.AbstainCount) successCount := float64(response.VotePenaltyCounter.SuccessCount) - metrics.votePenaltyCount.WithLabelValues("miss").Add(missCount) - metrics.votePenaltyCount.WithLabelValues("abstain").Add(abstainCount) - metrics.votePenaltyCount.WithLabelValues("success").Add(successCount) + metrics.votePenaltyCount.WithLabelValues("miss", validatorAddress.String()).Add(missCount) + metrics.votePenaltyCount.WithLabelValues("abstain", validatorAddress.String()).Add(abstainCount) + metrics.votePenaltyCount.WithLabelValues("success", validatorAddress.String()).Add(successCount) }() diff --git a/cmd/sei-cosmos-exporter/single.go b/cmd/sei-cosmos-exporter/single.go index f63a944..2602079 100644 --- a/cmd/sei-cosmos-exporter/single.go +++ b/cmd/sei-cosmos-exporter/single.go @@ -24,6 +24,7 @@ func SeiSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Servic var paramsMetrics *exporter.ParamsMetrics var upgradeMetrics *exporter.UpgradeMetrics var walletMetrics *exporter.WalletMetrics + var seiMetrics *SeiMetrics var proposalMetrics *exporter.ProposalsMetrics @@ -42,6 +43,9 @@ func SeiSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Servic if s.Proposals { proposalMetrics = exporter.NewProposalsMetrics(registry, s.Config) } + if s.Oracle { + seiMetrics = NewSeiMetrics(registry, s.Config) + } var wg sync.WaitGroup @@ -77,9 +81,8 @@ func SeiSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Servic }() if s.Oracle { - sublogger.Debug().Str("address", validator).Msg("Fetching Kujira details") - - // getKujiMetrics(&wg, &sublogger, kujiOracleMetrics, s, s.Config, valAddress) + sublogger.Debug().Str("address", validator).Msg("Fetching SEI details") + getSeiMetrics(&wg, &sublogger, seiMetrics, s, s.Config, valAddress) } } } @@ -101,6 +104,7 @@ func SeiSingleHandler(w http.ResponseWriter, r *http.Request, s *exporter.Servic if s.Proposals { exporter.GetProposalsMetrics(&wg, &sublogger, proposalMetrics, s, s.Config, true) } + wg.Wait() h := promhttp.HandlerFor(registry, promhttp.HandlerOpts{})