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
#17910) (#17915)

Co-authored-by: Marko <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
3 people authored Sep 27, 2023
1 parent 13bd226 commit 71c9b76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (x/gov) [#17873](https://github.com/cosmos/cosmos-sdk/pull/17873) Fail any inactive and active proposals that cannot be decoded.

### 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.50.0-rc.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.0-rc.1) - 2023-09-25

### Features
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 @@ -4,14 +4,10 @@ import (
"context"
"encoding/json"
"fmt"
"strconv"

"github.com/hashicorp/go-metrics"

"cosmossdk.io/errors"
"cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
Expand Down Expand Up @@ -99,8 +95,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 @@ -190,14 +184,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 Down Expand Up @@ -243,14 +229,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 @@ -271,14 +249,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 71c9b76

Please sign in to comment.