Skip to content

Commit

Permalink
Add price update counter for price-feeder (sei-protocol#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonWeng authored Apr 6, 2023
1 parent 84f9a25 commit 92b6e5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/metrics/metrics_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,15 @@ func SetThroughputMetric(metricName string, value float32) {
"sei", "throughput", metricName,
)
}

// Measures number of times a denom's price is updated
// Metric Name:
//
// sei_oracle_price_update_count
func IncrPriceUpdateDenom(denom string) {
telemetry.IncrCounterWithLabels(
[]string{"sei", "oracle", "price", "update"},
1,
[]metrics.Label{telemetry.NewLabel("denom", denom)},
)
}
2 changes: 2 additions & 0 deletions x/oracle/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"sort"
"time"

"github.com/sei-protocol/sei-chain/utils/metrics"
"github.com/sei-protocol/sei-chain/x/oracle/keeper"
"github.com/sei-protocol/sei-chain/x/oracle/types"
"github.com/sei-protocol/sei-chain/x/oracle/utils"
Expand Down Expand Up @@ -90,6 +91,7 @@ func MidBlocker(ctx sdk.Context, k keeper.Keeper) {
}

// Set the exchange rate, emit ABCI event
metrics.IncrPriceUpdateDenom(denom)
k.SetBaseExchangeRateWithEvent(ctx, denom, exchangeRate)
}
}
Expand Down

0 comments on commit 92b6e5a

Please sign in to comment.