Skip to content

Commit 0131d99

Browse files
authored
[go.mod] bump for throughput metrics and metrics fix (#801)
* [go.mod] bump for throughput metrics and metrics fix * bump
1 parent 4bbb537 commit 0131d99

File tree

5 files changed

+17
-27
lines changed

5 files changed

+17
-27
lines changed

app/app.go

+2-22
Original file line numberDiff line numberDiff line change
@@ -1001,32 +1001,13 @@ func (app *App) FinalizeBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock)
10011001
return &resp, nil
10021002
}
10031003

1004-
func (app *App) RecordAndEmitMetrics(ctx sdk.Context) {
1005-
height := float32(ctx.BlockHeight())
1006-
if (*app.metricCounter)["last_updated_height"] == height {
1007-
app.Logger().Debug("Metrics already recorded for this block", "height", height)
1008-
return
1009-
}
1010-
1011-
for metricName, value := range *ctx.ContextMemCache().GetMetricCounters() {
1012-
(*app.metricCounter)[metricName] += float32(value)
1013-
}
1014-
(*app.metricCounter)["last_updated_height"] = height
1015-
1016-
for metricName, value := range *(app.metricCounter) {
1017-
metrics.SetThroughputMetric(metricName, value)
1018-
}
1019-
1020-
ctx.ContextMemCache().Clear()
1021-
}
1022-
10231004
func (app *App) DeliverTxWithResult(ctx sdk.Context, tx []byte) *abci.ExecTxResult {
10241005
deliverTxResp := app.DeliverTx(ctx, abci.RequestDeliverTx{
10251006
Tx: tx,
10261007
})
10271008

1028-
ctx.ContextMemCache().IncrMetricCounter(uint32(deliverTxResp.GasWanted), "gas_wanted")
1029-
ctx.ContextMemCache().IncrMetricCounter(uint32(deliverTxResp.GasUsed), "gas_used")
1009+
metrics.IncrGasCounter("gas_used", deliverTxResp.GasUsed)
1010+
metrics.IncrGasCounter("gas_wanted", deliverTxResp.GasWanted)
10301011

10311012
return &abci.ExecTxResult{
10321013
Code: deliverTxResp.Code,
@@ -1345,7 +1326,6 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ
13451326
})
13461327

13471328
events = append(events, endBlockResp.Events...)
1348-
app.RecordAndEmitMetrics(ctx)
13491329
return events, txResults, endBlockResp, nil
13501330
}
13511331

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ require (
269269
replace (
270270
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.0.2
271271
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
272-
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.34
272+
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.35
273273
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.4
274274
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
275275
github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,8 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod
10671067
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
10681068
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
10691069
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
1070-
github.com/sei-protocol/sei-cosmos v0.2.34 h1:7VYsZn4W8FMlP7gEu8JTYAhD4JGYCGOY70AFRVwCUwg=
1071-
github.com/sei-protocol/sei-cosmos v0.2.34/go.mod h1:eV7NmvcXn1D6A3EDvOFZ894tqm+/JW4CWUiohnamjfM=
1070+
github.com/sei-protocol/sei-cosmos v0.2.35 h1:VfbkGXP2GJBi+/7Eu1pbV4ea+g1KzjatrAXLVrZR+Q4=
1071+
github.com/sei-protocol/sei-cosmos v0.2.35/go.mod h1:eV7NmvcXn1D6A3EDvOFZ894tqm+/JW4CWUiohnamjfM=
10721072
github.com/sei-protocol/sei-iavl v0.1.4 h1:lT5doPDTBq/UlbofQbM5iS01FbTSJttmA22+d0PJj5o=
10731073
github.com/sei-protocol/sei-iavl v0.1.4/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
10741074
github.com/sei-protocol/sei-tendermint v0.2.17 h1:TwOVyF8F+Of2G8UEt0ShHDFQcFNmbGy4/c5Uui5UHqg=

utils/metrics/metrics_util.go

+12
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,15 @@ func SetCoinsMinted(amount uint64, denom string) {
197197
[]metrics.Label{telemetry.NewLabel("denom", denom)},
198198
)
199199
}
200+
201+
// Measures the number of times the total block gas wanted in the proposal exceeds the max
202+
// Metric Name:
203+
//
204+
// sei_tx_gas_counter
205+
func IncrGasCounter(gasType string, value int64) {
206+
telemetry.IncrCounterWithLabels(
207+
[]string{"sei", "tx", "gas", "counter"},
208+
float32(value),
209+
[]metrics.Label{telemetry.NewLabel("type", gasType)},
210+
)
211+
}

x/dex/keeper/msgserver/msg_server_place_orders.go

-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ func (k msgServer) transferFunds(goCtx context.Context, msg *types.MsgPlaceOrder
4545
func (k msgServer) PlaceOrders(goCtx context.Context, msg *types.MsgPlaceOrders) (*types.MsgPlaceOrdersResponse, error) {
4646
ctx := sdk.UnwrapSDKContext(goCtx)
4747

48-
defer ctx.ContextMemCache().IncrMetricCounter(uint32(len(msg.Orders)), sdk.ORDER_COUNT)
49-
5048
if err := msg.ValidateBasic(); err != nil {
5149
ctx.Logger().Error(fmt.Sprintf("request invalid: %s", err))
5250
return nil, err

0 commit comments

Comments
 (0)