5
5
"context"
6
6
"database/sql"
7
7
"fmt"
8
+ "time"
8
9
9
10
"github.com/jackc/pgx/v4"
10
11
"github.com/jackc/pgx/v4/pgxpool"
@@ -17,6 +18,7 @@ import (
17
18
corekeyperdatabase "github.com/shutter-network/rolling-shutter/rolling-shutter/keyper/database"
18
19
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/gnosis/database"
19
20
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/gnosis/gnosisssztypes"
21
+ "github.com/shutter-network/rolling-shutter/rolling-shutter/medley"
20
22
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/identitypreimage"
21
23
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/retry"
22
24
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/service"
@@ -173,14 +175,21 @@ func (i *MessagingMiddleware) interceptDecryptionKeyShares(
173
175
)
174
176
}
175
177
176
- msg := proto .Clone (originalMsg ).(* p2pmsg.DecryptionKeyShares )
177
- msg .Extra = & p2pmsg.DecryptionKeyShares_Gnosis {
178
- Gnosis : & p2pmsg.GnosisDecryptionKeySharesExtra {
179
- Slot : uint64 (currentDecryptionTrigger .Slot ),
180
- TxPointer : uint64 (currentDecryptionTrigger .TxPointer ),
181
- Signature : signature ,
182
- },
178
+ extra := & p2pmsg.GnosisDecryptionKeySharesExtra {
179
+ Slot : uint64 (currentDecryptionTrigger .Slot ),
180
+ TxPointer : uint64 (currentDecryptionTrigger .TxPointer ),
181
+ Signature : signature ,
183
182
}
183
+ msg := proto .Clone (originalMsg ).(* p2pmsg.DecryptionKeyShares )
184
+ msg .Extra = & p2pmsg.DecryptionKeyShares_Gnosis {Gnosis : extra }
185
+ slotStartTimestamp := medley .SlotToTimestamp (
186
+ extra .Slot ,
187
+ i .config .Gnosis .GenesisSlotTimestamp ,
188
+ i .config .Gnosis .SecondsPerSlot ,
189
+ )
190
+ slotStartTime := time .Unix (int64 (slotStartTimestamp ), 0 )
191
+ delta := time .Since (slotStartTime )
192
+ metricsKeySharesSentTimeDelta .WithLabelValues (fmt .Sprint (originalMsg .Eon )).Observe (delta .Seconds ())
184
193
return msg , nil
185
194
}
186
195
@@ -267,6 +276,15 @@ func (i *MessagingMiddleware) interceptDecryptionKeys(
267
276
Int ("num-signatures" , len (signaturesDB )).
268
277
Int ("num-keys" , len (msg .Keys )).
269
278
Msg ("sending keys" )
279
+
280
+ slotStartTimestamp := medley .SlotToTimestamp (
281
+ extra .Slot ,
282
+ i .config .Gnosis .GenesisSlotTimestamp ,
283
+ i .config .Gnosis .SecondsPerSlot ,
284
+ )
285
+ slotStartTime := time .Unix (int64 (slotStartTimestamp ), 0 )
286
+ delta := time .Since (slotStartTime )
287
+ metricsKeysSentTimeDelta .WithLabelValues (fmt .Sprint (originalMsg .Eon )).Observe (delta .Seconds ())
270
288
return msg , nil
271
289
}
272
290
0 commit comments