Skip to content

Commit

Permalink
feat: updated metric name for gauge to include published messages tha…
Browse files Browse the repository at this point in the history
…t are ignored (ChainSafe#402)
  • Loading branch information
maschad committed Feb 16, 2023
1 parent 6c8c0c2 commit 2d30405
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements PubSub<G
// This message has already been seen. We don't re-publish messages that have already
// been published on the network.
if (ignoreDuplicateMessages) {
this.metrics?.onIgnoreDuplicateMsg(topic)
this.metrics?.onIgnorePublishedDuplicateMsg(topic)
return { recipients: [] }
}
throw Error('PublishError.Duplicate')
Expand Down
6 changes: 3 additions & 3 deletions src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ export function getMetrics(
}),

duplicateMsgIgnored: register.gauge<{ topic: TopicLabel }>({
name: 'gossisub_duplicate_msg_ignored_total',
help: 'Total count of duplicate message ignored by topic',
name: 'gossisub_published_duplicate_msgs_ignored_total',
help: 'Total count of published duplicate message ignored by topic',
labelNames: ['topic']
}),

Expand Down Expand Up @@ -635,7 +635,7 @@ export function getMetrics(
}
},

onIgnoreDuplicateMsg(topicStr: TopicStr): void {
onIgnorePublishedDuplicateMsg(topicStr: TopicStr): void {
const topic = this.toTopic(topicStr)
this.duplicateMsgIgnored.inc({ topic }, 1)
},
Expand Down

0 comments on commit 2d30405

Please sign in to comment.