@@ -341,16 +341,24 @@ export function getMetrics(
341
341
labelNames : [ 'topic' , 'error' ]
342
342
} ) ,
343
343
/** Track duplicate message delivery time */
344
- duplicateMsgDelivery : register . histogram < { topic : TopicLabel } > ( {
344
+ duplicateMsgDeliveryDelay : register . histogram ( {
345
345
name : 'gossisub_duplicate_msg_delivery_delay_seconds' ,
346
346
help : 'Time since the 1st duplicated message validated' ,
347
347
labelNames : [ 'topic' ] ,
348
348
buckets : [
349
+ 0.25 * opts . minMeshMessageDeliveriesWindow ,
349
350
0.5 * opts . minMeshMessageDeliveriesWindow ,
350
351
1 * opts . minMeshMessageDeliveriesWindow ,
351
- 2 * opts . minMeshMessageDeliveriesWindow
352
+ 2 * opts . minMeshMessageDeliveriesWindow ,
353
+ 4 * opts . minMeshMessageDeliveriesWindow
352
354
]
353
355
} ) ,
356
+ /** Total count of late msg delivery total by topic */
357
+ duplicateMsgLateDelivery : register . gauge < { topic : TopicLabel } > ( {
358
+ name : 'gossisub_duplicate_msg_late_delivery_total' ,
359
+ help : 'Total count of late duplicate message delivery by topic, which triggers P3 penalty' ,
360
+ labelNames : [ 'topic' ]
361
+ } ) ,
354
362
355
363
/* Metrics related to scoring */
356
364
/** Total times score() is called */
@@ -403,9 +411,11 @@ export function getMetrics(
403
411
name : 'gossipsub_peer_stat_behaviour_penalty' ,
404
412
help : 'Current peer stat behaviour_penalty at each scrape' ,
405
413
buckets : [
414
+ 0.25 * opts . behaviourPenaltyThreshold ,
406
415
0.5 * opts . behaviourPenaltyThreshold ,
407
416
1 * opts . behaviourPenaltyThreshold ,
408
- 2 * opts . behaviourPenaltyThreshold
417
+ 2 * opts . behaviourPenaltyThreshold ,
418
+ 4 * opts . behaviourPenaltyThreshold
409
419
]
410
420
} ) ,
411
421
@@ -592,9 +602,12 @@ export function getMetrics(
592
602
this . msgReceivedInvalid . inc ( { topic, error } , 1 )
593
603
} ,
594
604
595
- onDuplicateMsgDelivery ( topicStr : TopicStr , deliveryDelayMs : number ) : void {
596
- const topic = this . toTopic ( topicStr )
597
- this . duplicateMsgDelivery . observe ( { topic } , deliveryDelayMs / 1000 )
605
+ onDuplicateMsgDelivery ( topicStr : TopicStr , deliveryDelayMs : number , isLateDelivery : boolean ) : void {
606
+ this . duplicateMsgDeliveryDelay . observe ( deliveryDelayMs / 1000 )
607
+ if ( isLateDelivery ) {
608
+ const topic = this . toTopic ( topicStr )
609
+ this . duplicateMsgLateDelivery . inc ( { topic } , 1 )
610
+ }
598
611
} ,
599
612
600
613
onRpcRecv ( rpc : IRPC , rpcBytes : number ) : void {
0 commit comments