Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup metrics #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions x/keyshare/keeper/msg_server_send_keyshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"strconv"

"github.com/Fairblock/fairyring/x/keyshare/types"
"github.com/armon/go-metrics"
"github.com/cosmos/cosmos-sdk/telemetry"

distIBE "github.com/FairBlock/DistributedIBE"
peptypes "github.com/Fairblock/fairyring/x/pep/types"
Expand Down Expand Up @@ -70,7 +68,6 @@ func (k msgServer) SendKeyshare(goCtx context.Context, msg *types.MsgSendKeyshar
// Parse the keyshare & commitment then verify it
_, _, err := parseKeyShareCommitment(suite, msg.Message, commitments.Commitments[msg.KeyShareIndex-1], uint32(msg.KeyShareIndex), ibeID)
if err != nil {
defer telemetry.IncrCounter(1, types.KeyTotalInvalidKeyShareSubmitted)
k.Logger(ctx).Error(fmt.Sprintf("Error in parsing & verifying keyshare & commitment: %s", err.Error()))
k.Logger(ctx).Error(fmt.Sprintf("KeyShare is: %v | Commitment is: %v | Index: %d", msg.Message, commitments.Commitments, msg.KeyShareIndex))
// Invalid Share, slash validator
Expand Down Expand Up @@ -160,7 +157,6 @@ func (k msgServer) SendKeyshare(goCtx context.Context, msg *types.MsgSendKeyshar
// If there is not enough keyshares to aggregate OR there is already an aggregated key
// Only continue the code if there is enough keyshare to aggregate & no aggregated key for current height
if int64(len(stateKeyShares)) < expectedThreshold || found {
defer telemetry.IncrCounterWithLabels([]string{types.KeyTotalValidKeyShareSubmitted}, 1, []metrics.Label{telemetry.NewLabel("aggrkey", aggrKeyData.Data)})
return &types.MsgSendKeyshareResponse{
Creator: msg.Creator,
Keyshare: msg.Message,
Expand Down Expand Up @@ -213,8 +209,6 @@ func (k msgServer) SendKeyshare(goCtx context.Context, msg *types.MsgSendKeyshar

k.Logger(ctx).Info(fmt.Sprintf("Aggregated Decryption Key for Block %d: %s", msg.BlockHeight, skHex))

defer telemetry.IncrCounterWithLabels([]string{types.KeyTotalValidKeyShareSubmitted}, 1, []metrics.Label{telemetry.NewLabel("aggrkey", skHex)})

ctx.EventManager().EmitEvent(
sdk.NewEvent(types.KeyShareAggregatedEventType,
sdk.NewAttribute(types.KeyShareAggregatedEventBlockHeight, strconv.FormatUint(msg.BlockHeight, 10)),
Expand Down