Skip to content

Commit

Permalink
Move gathereing price telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
starsquidnodes committed Aug 2, 2024
1 parent 95ab5fd commit 4fb47b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 11 additions & 0 deletions x/oracle/abci/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import (
"github.com/Team-Kujira/core/x/oracle/types"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/mempool"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/hashicorp/go-metrics"
)

// StakeWeightedPrices defines the structure a proposer should use to calculate
Expand Down Expand Up @@ -264,6 +266,15 @@ func (h *ProposalHandler) GetBallotByDenom(ctx sdk.Context, ci abci.ExtendedComm
tmpPower = 0
}

telemetry.SetGaugeWithLabels(
[]string{"oracle", "price"},
float32(price.MustFloat64()),
[]metrics.Label{
telemetry.NewLabel("denom", base),
telemetry.NewLabel("validator", valAddr.String()),
},
)

votes[base] = append(votes[base],
types.NewVoteForTally(
price,
Expand Down
6 changes: 0 additions & 6 deletions x/oracle/keeper/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ func Tally(_ sdk.Context,
key := vote.Voter.String()
claim := validatorClaimMap[key]

telemetry.SetGaugeWithLabels(
[]string{"oracle", "price"},
float32(vote.ExchangeRate.MustFloat64()),
append(labels, telemetry.NewLabel("validator", key)),
)

// Filter ballot winners & abstain voters
if (vote.ExchangeRate.GTE(weightedMedian.Sub(spread)) &&
vote.ExchangeRate.LTE(weightedMedian.Add(spread))) ||
Expand Down

0 comments on commit 4fb47b8

Please sign in to comment.