0g-chain/x/metrics/abci.go
mergify[bot] 6c565343f7
feat(x/metrics): add module for emiting custom chain metrics (backport #1668) (#1677)
* feat(x/metrics): add module for emiting custom chain metrics (#1668)

* initialize x/metrics with metrics collection

* include global labels in x/metrics metrics

* add x/metrics spec

* add x/metrics test coverage

* update changelog

(cherry picked from commit 9a0aed7626)

# Conflicts:
#	CHANGELOG.md

* fix changlog conflicts

---------

Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>
2023-08-25 15:14:14 -07:00

13 lines
301 B
Go

package metrics
import (
"github.com/kava-labs/kava/x/metrics/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// BeginBlocker publishes metrics at the start of each block.
func BeginBlocker(ctx sdk.Context, metrics *types.Metrics) {
metrics.LatestBlockHeight.Set(float64(ctx.BlockHeight()))
}