Skip to content

Commit e7de693

Browse files
committed
chore: correct typo and metric names
1 parent 3551dbc commit e7de693

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,7 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements PubSub<G
21722172
// else, Message not in cache. Ignoring forwarding
21732173
}
21742174

2175-
const firstSeenTimestampMs = this.score.messageFirstSeeenTimestampMs(msgId)
2175+
const firstSeenTimestampMs = this.score.messageFirstSeenTimestampMs(msgId)
21762176
this.metrics?.onReportValidation(cacheEntry, acceptance, firstSeenTimestampMs)
21772177
}
21782178

src/metrics.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,15 @@ export function getMetrics(
249249
labelNames: ['hit']
250250
}),
251251

252-
asyncValidationDelayFromFirstSeen: register.histogram<{ topic: TopicLabel }>({
252+
asyncValidationDelayFromFirstSeenSec: register.histogram<{ topic: TopicLabel }>({
253253
name: 'gossipsub_async_validation_delay_from_first_seen',
254-
help: 'Async validation report delay from first seen',
254+
help: 'Async validation report delay from first seen in second',
255255
labelNames: ['topic'],
256256
buckets: [0.01, 0.03, 0.1, 0.3, 1, 3, 10]
257257
}),
258258

259259
asyncValidationUnknownFirstSeen: register.gauge({
260-
name: 'gossipsub_async_validation_unknown_first_seen',
260+
name: 'gossipsub_async_validation_unknown_first_seen_count_total',
261261
help: 'Async validation report unknown first seen value for message'
262262
}),
263263

@@ -588,7 +588,10 @@ export function getMetrics(
588588
this.meshPeerChurnEvents.inc({ topic, reason }, count)
589589
},
590590

591-
// null messageRecord means the message's mcache record was not known at the time of acceptance report
591+
/**
592+
* Update validation result to metrics
593+
* @param messageRecord null means the message's mcache record was not known at the time of acceptance report
594+
*/
592595
onReportValidation(
593596
messageRecord: { message: { topic: TopicStr } } | null,
594597
acceptance: TopicValidatorResult,
@@ -598,11 +601,11 @@ export function getMetrics(
598601

599602
if (messageRecord != null) {
600603
const topic = this.toTopic(messageRecord.message.topic)
601-
this.asyncValidationResult.inc({ topic: topic, acceptance })
604+
this.asyncValidationResult.inc({ topic, acceptance })
602605
}
603606

604607
if (firstSeenTimestampMs != null) {
605-
this.asyncValidationDelayFromFirstSeen.observe((Date.now() - firstSeenTimestampMs) / 1000)
608+
this.asyncValidationDelayFromFirstSeenSec.observe((Date.now() - firstSeenTimestampMs) / 1000)
606609
} else {
607610
this.asyncValidationUnknownFirstSeen.inc()
608611
}

src/score/peer-score.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class PeerScore {
100100
return Object.fromEntries(Array.from(this.peerStats.entries()).map(([peer, stats]) => [peer, stats]))
101101
}
102102

103-
messageFirstSeeenTimestampMs(msgIdStr: MsgIdStr): number | null {
103+
messageFirstSeenTimestampMs(msgIdStr: MsgIdStr): number | null {
104104
const drec = this.deliveryRecords.getRecord(msgIdStr)
105105
return drec ? drec.firstSeenTsMs : null
106106
}

0 commit comments

Comments
 (0)