all: remove telemetry (#545)

This commit is contained in:
Federico Kunze Küllmer 2021-09-09 18:39:55 +02:00 committed by GitHub
parent 587cf78b5c
commit 540bd79f7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 50 deletions

2
go.mod
View File

@ -3,7 +3,6 @@ module github.com/tharsis/ethermint
go 1.17 go 1.17
require ( require (
github.com/armon/go-metrics v0.3.9
github.com/btcsuite/btcd v0.22.0-beta github.com/btcsuite/btcd v0.22.0-beta
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cosmos/cosmos-sdk v0.44.0 github.com/cosmos/cosmos-sdk v0.44.0
@ -48,6 +47,7 @@ require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/VictoriaMetrics/fastcache v1.5.7 // indirect github.com/VictoriaMetrics/fastcache v1.5.7 // indirect
github.com/Workiva/go-datastructures v1.0.52 // indirect github.com/Workiva/go-datastructures v1.0.52 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect

View File

@ -1,20 +1,15 @@
package keeper package keeper
import ( import (
"time"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
ethtypes "github.com/ethereum/go-ethereum/core/types" ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/tharsis/ethermint/x/evm/types"
) )
// BeginBlock sets the sdk Context and EIP155 chain id to the Keeper. // BeginBlock sets the sdk Context and EIP155 chain id to the Keeper.
func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)
k.WithContext(ctx) k.WithContext(ctx)
k.WithChainID(ctx) k.WithChainID(ctx)
} }
@ -23,8 +18,6 @@ func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
// KVStore. The EVM end block logic doesn't update the validator set, thus it returns // KVStore. The EVM end block logic doesn't update the validator set, thus it returns
// an empty slice. // an empty slice.
func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
// Gas costs are handled within msg handler so costs should be ignored // Gas costs are handled within msg handler so costs should be ignored
infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
k.WithContext(infCtx) k.WithContext(infCtx)

View File

@ -3,15 +3,12 @@ package keeper
import ( import (
"context" "context"
"fmt" "fmt"
"time"
"github.com/armon/go-metrics"
"github.com/palantir/stacktrace" "github.com/palantir/stacktrace"
tmbytes "github.com/tendermint/tendermint/libs/bytes" tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/evm/types" "github.com/tharsis/ethermint/x/evm/types"
@ -24,46 +21,17 @@ var _ types.MsgServer = &Keeper{}
// so that it can implements and call the StateDB methods without receiving it as a function // so that it can implements and call the StateDB methods without receiving it as a function
// parameter. // parameter.
func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*types.MsgEthereumTxResponse, error) { func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*types.MsgEthereumTxResponse, error) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), types.TypeMsgEthereumTx)
ctx := sdk.UnwrapSDKContext(goCtx) ctx := sdk.UnwrapSDKContext(goCtx)
k.WithContext(ctx) k.WithContext(ctx)
sender := msg.From sender := msg.From
tx := msg.AsTransaction() tx := msg.AsTransaction()
labels := []metrics.Label{telemetry.NewLabel("tx_type", fmt.Sprintf("%d", tx.Type()))}
if tx.To() == nil {
labels = []metrics.Label{
telemetry.NewLabel("execution", "create"),
}
} else {
labels = []metrics.Label{
telemetry.NewLabel("execution", "call"),
telemetry.NewLabel("to", tx.To().Hex()), // recipient address (contract or account)
}
}
response, err := k.ApplyTransaction(tx) response, err := k.ApplyTransaction(tx)
if err != nil { if err != nil {
return nil, stacktrace.Propagate(err, "failed to apply transaction") return nil, stacktrace.Propagate(err, "failed to apply transaction")
} }
defer func() {
if tx.Value().IsInt64() {
telemetry.SetGauge(
float32(tx.Value().Int64()),
"tx", "msg", "ethereum_tx",
)
}
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, "ethereum_tx"},
1,
labels,
)
}()
attrs := []sdk.Attribute{ attrs := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyAmount, tx.Value().String()), sdk.NewAttribute(sdk.AttributeKeyAmount, tx.Value().String()),
// add event for ethereum transaction hash format // add event for ethereum transaction hash format

View File

@ -2,12 +2,10 @@ package keeper
import ( import (
"math/big" "math/big"
"time"
"github.com/palantir/stacktrace" "github.com/palantir/stacktrace"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
@ -132,8 +130,6 @@ func (k Keeper) GetHashFn() vm.GetHashFunc {
// //
// For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072 // For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072
func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumTxResponse, error) { func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumTxResponse, error) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), types.MetricKeyTransitionDB)
ctx := k.Ctx() ctx := k.Ctx()
params := k.GetParams(ctx) params := k.GetParams(ctx)

View File

@ -2,22 +2,16 @@ package keeper
import ( import (
"fmt" "fmt"
"time"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/feemarket/types"
) )
// EndBlock also retrieves the bloom filter value from the transient store and commits it to the // EndBlock also retrieves the bloom filter value from the transient store and commits it to the
// KVStore. The EVM end block logic doesn't update the validator set, thus it returns // KVStore. The EVM end block logic doesn't update the validator set, thus it returns
// an empty slice. // an empty slice.
func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) { func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
baseFee := k.CalculateBaseFee(ctx) baseFee := k.CalculateBaseFee(ctx)
if baseFee == nil { if baseFee == nil {
return return