Skip to content

Commit

Permalink
Continously emit version metrics (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonWeng authored Mar 7, 2023
1 parent c464c96 commit 7aa30f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
15 changes: 5 additions & 10 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ type App struct {

// batchVerifier *ante.SR25519BatchVerifier
txDecoder sdk.TxDecoder

versionInfo version.Info
}

// New returns a reference to an initialized blockchain app
Expand Down Expand Up @@ -399,7 +401,8 @@ func New(
Tracer: &tr,
TracerContext: context.Background(),
},
txDecoder: encodingConfig.TxConfig.TxDecoder(),
txDecoder: encodingConfig.TxConfig.TxDecoder(),
versionInfo: version.NewInfo(),
}

app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
Expand Down Expand Up @@ -895,15 +898,7 @@ func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp }

// BeginBlocker application updates every begin block
func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
// newCtx := ctx.WithContext(
// context.WithValue(ctx.Context(), dexcache.GOCTX_KEY, dexcache.NewOrders()),
// )
// app.Logger().Info(fmt.Sprintf("BeginBlocker context %s", newCtx.Context().Value(dexcache.GOCTX_KEY).(dexcache.Orders)))
if !EmittedSeidVersionMetric {
verInfo := version.NewInfo()
metrics.GaugeSeidVersionAndCommit(verInfo.Version, verInfo.GitCommit)
EmittedSeidVersionMetric = true
}
metrics.GaugeSeidVersionAndCommit(app.versionInfo.Version, app.versionInfo.GitCommit)
return app.mm.BeginBlock(ctx, req)
}

Expand Down
2 changes: 1 addition & 1 deletion x/oracle/keeper/test_utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// nolint
//nolint
package keeper

import (
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func WeightedOperations(
}

// SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values.
// nolint: funlen
//nolint: funlen
func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
Expand Down Expand Up @@ -122,7 +122,7 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK
}

// SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values.
// nolint: funlen
//nolint: funlen
func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
Expand Down

0 comments on commit 7aa30f4

Please sign in to comment.