refactor: simplify collected metrics (#21963)
This commit is contained in:
@@ -18,7 +18,6 @@ require (
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/golang/protobuf v1.5.4
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
github.com/hashicorp/go-metrics v0.5.3
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/stretchr/testify v1.9.0
|
||||
@@ -92,6 +91,7 @@ require (
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
||||
github.com/hashicorp/go-hclog v1.6.3 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-metrics v0.5.3 // indirect
|
||||
github.com/hashicorp/go-plugin v1.6.1 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
|
||||
@@ -11,7 +11,8 @@ import (
|
||||
// BeginBlocker sets the proposer for determining distribution during endblock
|
||||
// and distribute rewards for the previous block.
|
||||
func (k Keeper) BeginBlocker(ctx context.Context) error {
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker)
|
||||
start := telemetry.Now()
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, start, telemetry.MetricKeyBeginBlocker)
|
||||
|
||||
// determine the total power signing the block
|
||||
var previousTotalPower int64
|
||||
|
||||
@@ -4,12 +4,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/go-metrics"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
"cosmossdk.io/x/distribution/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
@@ -61,18 +58,6 @@ func (k msgServer) WithdrawDelegatorReward(ctx context.Context, msg *types.MsgWi
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
for _, a := range amount {
|
||||
if a.Amount.IsInt64() {
|
||||
telemetry.SetGaugeWithLabels(
|
||||
[]string{"tx", "msg", "withdraw_reward"},
|
||||
float32(a.Amount.Int64()),
|
||||
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
|
||||
)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return &types.MsgWithdrawDelegatorRewardResponse{Amount: amount}, nil
|
||||
}
|
||||
|
||||
@@ -87,18 +72,6 @@ func (k msgServer) WithdrawValidatorCommission(ctx context.Context, msg *types.M
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
for _, a := range amount {
|
||||
if a.Amount.IsInt64() {
|
||||
telemetry.SetGaugeWithLabels(
|
||||
[]string{"tx", "msg", "withdraw_commission"},
|
||||
float32(a.Amount.Int64()),
|
||||
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
|
||||
)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return &types.MsgWithdrawValidatorCommissionResponse{Amount: amount}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user