Skip to content

Commit

Permalink
refactor(x/gov): remove gov vote and proposal based telemetry (backport
Browse files Browse the repository at this point in the history
cosmos#17910) (cosmos#17916)

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
  • Loading branch information
3 people authored and mmsqe committed Oct 9, 2023
1 parent a354b49 commit 60909f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (baseapp) [#17769](https://github.com/cosmos/cosmos-sdk/pull/17769) Ensure we respect block size constraints in the `DefaultProposalHandler`'s `PrepareProposal` handler when a nil or no-op mempool is used. We provide a `TxSelector` type to assist in making transaction selection generalized. We also fix a comparison bug in tx selection when `req.maxTxBytes` is reached.
* (config) [#17649](https://github.com/cosmos/cosmos-sdk/pull/17649) Fix `mempool.max-txs` configuration is invalid in `app.config`.
* (mempool) [#17668](https://github.com/cosmos/cosmos-sdk/pull/17668) Fix `PriorityNonceIterator.Next()` nil pointer ref for min priority at the end of iteration.
* (x/auth) [#17902](https://github.com/cosmos/cosmos-sdk/pull/17902) Remove tip posthandler
* (x/auth) [#17902](https://github.com/cosmos/cosmos-sdk/pull/17902) Remove tip posthandler.

### Client Breaking Changes

* (x/gov) [#17910](https://github.com/cosmos/cosmos-sdk/pull/17910) Remove telemetry for counting votes and proposals. It was incorrectly counting votes. Use alternatives, such as state streaming.

## [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5) - 2023-09-01

Expand Down
30 changes: 0 additions & 30 deletions x/gov/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ package keeper
import (
"context"
"fmt"
"strconv"

"cosmossdk.io/errors"
"github.com/armon/go-metrics"

"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
Expand Down Expand Up @@ -63,8 +59,6 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
"submit proposal",
)

defer telemetry.IncrCounter(1, govtypes.ModuleName, "proposal")

votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.Id, proposer, msg.GetInitialDeposit())
if err != nil {
return nil, err
Expand Down Expand Up @@ -122,14 +116,6 @@ func (k msgServer) Vote(goCtx context.Context, msg *v1.MsgVote) (*v1.MsgVoteResp
return nil, err
}

defer telemetry.IncrCounterWithLabels(
[]string{govtypes.ModuleName, "vote"},
1,
[]metrics.Label{
telemetry.NewLabel("proposal_id", strconv.FormatUint(msg.ProposalId, 10)),
},
)

return &v1.MsgVoteResponse{}, nil
}

Expand All @@ -145,14 +131,6 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *v1.MsgVoteWeighted)
return nil, err
}

defer telemetry.IncrCounterWithLabels(
[]string{govtypes.ModuleName, "vote"},
1,
[]metrics.Label{
telemetry.NewLabel("proposal_id", strconv.FormatUint(msg.ProposalId, 10)),
},
)

return &v1.MsgVoteWeightedResponse{}, nil
}

Expand All @@ -168,14 +146,6 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe
return nil, err
}

defer telemetry.IncrCounterWithLabels(
[]string{govtypes.ModuleName, "deposit"},
1,
[]metrics.Label{
telemetry.NewLabel("proposal_id", strconv.FormatUint(msg.ProposalId, 10)),
},
)

if votingStarted {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
Expand Down

0 comments on commit 60909f3

Please sign in to comment.