Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Commit 9c018bf

Browse files
CysonCyson
authored andcommitted
Replace gauge with counter metric
1 parent 92141ee commit 9c018bf

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

modules/apps/transfer/keeper/relay.go

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (k Keeper) sendTransfer(
200200

201201
defer func() {
202202
if token.Amount.IsInt64() {
203-
telemetry.SetGaugeWithLabels(
203+
telemetry.IncrCounterWithLabels(
204204
[]string{"tx", "msg", "ibc", "transfer"},
205205
float32(token.Amount.Int64()),
206206
[]metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, fullDenomPath)},
@@ -291,8 +291,8 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
291291

292292
defer func() {
293293
if transferAmount.IsInt64() {
294-
telemetry.SetGaugeWithLabels(
295-
[]string{"ibc", types.ModuleName, "packet", "receive"},
294+
telemetry.IncrCounterWithLabels(
295+
[]string{"ibc", types.ModuleName, "packet", "receive", "native"},
296296
float32(transferAmount.Int64()),
297297
[]metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, unprefixedDenom)},
298298
)
@@ -351,8 +351,8 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
351351

352352
defer func() {
353353
if transferAmount.IsInt64() {
354-
telemetry.SetGaugeWithLabels(
355-
[]string{"ibc", types.ModuleName, "packet", "receive"},
354+
telemetry.IncrCounterWithLabels(
355+
[]string{"ibc", types.ModuleName, "packet", "receive", "non-native"},
356356
float32(transferAmount.Int64()),
357357
[]metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, data.Denom)},
358358
)
@@ -425,6 +425,16 @@ func (k Keeper) refundPacketToken(ctx sdk.Context, packet channeltypes.Packet, d
425425
return sdkerrors.Wrap(err, "unable to unescrow tokens, this may be caused by a malicious counterparty module or a bug: please open an issue on counterparty module")
426426
}
427427

428+
defer func() {
429+
if transferAmount.IsInt64() {
430+
telemetry.IncrCounterWithLabels(
431+
[]string{"ibc", types.ModuleName, "refund"},
432+
float32(transferAmount.Int64()),
433+
[]metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, data.Denom)},
434+
)
435+
}
436+
}()
437+
428438
return nil
429439
}
430440

@@ -439,6 +449,16 @@ func (k Keeper) refundPacketToken(ctx sdk.Context, packet channeltypes.Packet, d
439449
panic(fmt.Sprintf("unable to send coins from module to account despite previously minting coins to module account: %v", err))
440450
}
441451

452+
defer func() {
453+
if transferAmount.IsInt64() {
454+
telemetry.IncrCounterWithLabels(
455+
[]string{"ibc", types.ModuleName, "burn"},
456+
float32(transferAmount.Int64()),
457+
[]metrics.Label{telemetry.NewLabel(coretypes.LabelDenom, data.Denom)},
458+
)
459+
}
460+
}()
461+
442462
return nil
443463
}
444464

0 commit comments

Comments
 (0)