Skip to content

Commit

Permalink
fix: track publish time in second (#457)
Browse files Browse the repository at this point in the history
* fix: track publish time in second

* chore: fix comments
  • Loading branch information
twoeths authored Aug 3, 2023
1 parent 3153ebf commit 7c3fc8d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ export function getMetrics(
help: 'Total count of msg publish data.length bytes',
labelNames: ['topic']
}),
/** Total time in millisecond to publish a message */
msgPublishMs: register.histogram<{ topic: TopicLabel }>({
name: 'gossipsub_msg_publish_ms',
help: 'Total time in millisecond to publish a message',
buckets: [1, 2, 5, 10, 100, 500, 1000],
/** Total time in seconds to publish a message */
msgPublishTime: register.histogram<{ topic: TopicLabel }>({
name: 'gossipsub_msg_publish_seconds',
help: 'Total time in seconds to publish a message',
buckets: [0.001, 0.002, 0.005, 0.01, 0.1, 0.5, 1],
labelNames: ['topic']
}),

Expand Down Expand Up @@ -712,7 +712,7 @@ export function getMetrics(
this.msgPublishPeersByGroup.inc({ peerGroup: 'floodsub' }, tosendGroupCount.floodsub)
this.msgPublishPeersByGroup.inc({ peerGroup: 'mesh' }, tosendGroupCount.mesh)
this.msgPublishPeersByGroup.inc({ peerGroup: 'fanout' }, tosendGroupCount.fanout)
this.msgPublishMs.observe({ topic }, ms)
this.msgPublishTime.observe({ topic }, ms / 1000)
},

onMsgRecvPreValidation(topicStr: TopicStr): void {
Expand Down

0 comments on commit 7c3fc8d

Please sign in to comment.