diff --git a/src/index.ts b/src/index.ts index e666c0cd..884d2818 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2022,6 +2022,7 @@ export class GossipSub extends EventEmitter implements PubSub({ + name: 'gossisub_duplicate_msg_ignored_total', + help: 'Total count of duplicate message ignored by topic', + labelNames: ['topic'] + }), + /* Metrics related to scoring */ /** Total times score() is called */ scoreFnCalls: register.gauge({ @@ -629,6 +635,11 @@ export function getMetrics( } }, + onIgnoreDuplicateMsg(topicStr: TopicStr): void { + const topic = this.toTopic(topicStr) + this.duplicateMsgIgnored.inc({ topic }, 1) + }, + onRpcRecv(rpc: IRPC, rpcBytes: number): void { this.rpcRecvBytes.inc(rpcBytes) this.rpcRecvCount.inc(1)