@@ -13,6 +13,7 @@ import (
13
13
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
14
14
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
15
15
host "github.com/cosmos/ibc-go/modules/core/24-host"
16
+ coretypes "github.com/cosmos/ibc-go/modules/core/types"
16
17
)
17
18
18
19
// SendTransfer handles transfer sending logic. There are 2 possible cases:
@@ -101,16 +102,16 @@ func (k Keeper) SendTransfer(
101
102
}
102
103
103
104
labels := []metrics.Label {
104
- telemetry .NewLabel ("destination-port" , destinationPort ),
105
- telemetry .NewLabel ("destination-channel" , destinationChannel ),
105
+ telemetry .NewLabel (coretypes . LabelDestinationPort , destinationPort ),
106
+ telemetry .NewLabel (coretypes . LabelDestinationChannel , destinationChannel ),
106
107
}
107
108
108
109
// NOTE: SendTransfer simply sends the denomination as it exists on its own
109
110
// chain inside the packet data. The receiving chain will perform denom
110
111
// prefixing as necessary.
111
112
112
113
if types .SenderChainIsSource (sourcePort , sourceChannel , fullDenomPath ) {
113
- labels = append (labels , telemetry .NewLabel ("source" , "true" ))
114
+ labels = append (labels , telemetry .NewLabel (coretypes . LabelSource , "true" ))
114
115
115
116
// create the escrow address for the tokens
116
117
escrowAddress := types .GetEscrowAddress (sourcePort , sourceChannel )
@@ -123,7 +124,7 @@ func (k Keeper) SendTransfer(
123
124
}
124
125
125
126
} else {
126
- labels = append (labels , telemetry .NewLabel ("source" , "false" ))
127
+ labels = append (labels , telemetry .NewLabel (coretypes . LabelSource , "false" ))
127
128
128
129
// transfer the coins to the module account and burn them
129
130
if err := k .bankKeeper .SendCoinsFromAccountToModule (
@@ -165,7 +166,7 @@ func (k Keeper) SendTransfer(
165
166
telemetry .SetGaugeWithLabels (
166
167
[]string {"tx" , "msg" , "ibc" , "transfer" },
167
168
float32 (token .Amount .Int64 ()),
168
- []metrics.Label {telemetry .NewLabel ("denom" , fullDenomPath )},
169
+ []metrics.Label {telemetry .NewLabel (coretypes . LabelDenom , fullDenomPath )},
169
170
)
170
171
171
172
telemetry .IncrCounterWithLabels (
@@ -200,8 +201,8 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
200
201
}
201
202
202
203
labels := []metrics.Label {
203
- telemetry .NewLabel ("source-port" , packet .GetSourcePort ()),
204
- telemetry .NewLabel ("source-channel" , packet .GetSourceChannel ()),
204
+ telemetry .NewLabel (coretypes . LabelSourcePort , packet .GetSourcePort ()),
205
+ telemetry .NewLabel (coretypes . LabelSourceChannel , packet .GetSourceChannel ()),
205
206
}
206
207
207
208
// This is the prefix that would have been prefixed to the denomination
@@ -244,14 +245,14 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
244
245
telemetry .SetGaugeWithLabels (
245
246
[]string {"ibc" , types .ModuleName , "packet" , "receive" },
246
247
float32 (data .Amount ),
247
- []metrics.Label {telemetry .NewLabel ("denom" , unprefixedDenom )},
248
+ []metrics.Label {telemetry .NewLabel (coretypes . LabelDenom , unprefixedDenom )},
248
249
)
249
250
250
251
telemetry .IncrCounterWithLabels (
251
252
[]string {"ibc" , types .ModuleName , "receive" },
252
253
1 ,
253
254
append (
254
- labels , telemetry .NewLabel ("source" , "true" ),
255
+ labels , telemetry .NewLabel (coretypes . LabelSource , "true" ),
255
256
),
256
257
)
257
258
}()
@@ -303,14 +304,14 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
303
304
telemetry .SetGaugeWithLabels (
304
305
[]string {"ibc" , types .ModuleName , "packet" , "receive" },
305
306
float32 (data .Amount ),
306
- []metrics.Label {telemetry .NewLabel ("denom" , data .Denom )},
307
+ []metrics.Label {telemetry .NewLabel (coretypes . LabelDenom , data .Denom )},
307
308
)
308
309
309
310
telemetry .IncrCounterWithLabels (
310
311
[]string {"ibc" , types .ModuleName , "receive" },
311
312
1 ,
312
313
append (
313
- labels , telemetry .NewLabel ("source" , "false" ),
314
+ labels , telemetry .NewLabel (coretypes . LabelSource , "false" ),
314
315
),
315
316
)
316
317
}()
0 commit comments