-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: type safe metric labels #479
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #479 +/- ##
==========================================
- Coverage 81.38% 81.37% -0.02%
==========================================
Files 48 48
Lines 12275 12261 -14
Branches 1292 1292
==========================================
- Hits 9990 9977 -13
+ Misses 2285 2284 -1 ☔ View full report in Codecov by Sentry. |
@@ -328,10 +315,9 @@ export function getMetrics ( | |||
labelNames: ['hit'] | |||
}), | |||
|
|||
asyncValidationDelayFromFirstSeenSec: register.histogram<{ topic: TopicLabel }>({ | |||
asyncValidationDelayFromFirstSeenSec: register.histogram({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Label value is not set for this metric
js-libp2p-gossipsub/src/metrics.ts
Line 793 in eb53ea9
this.asyncValidationDelayFromFirstSeenSec.observe((Date.now() - firstSeenTimestampMs) / 1000) |
Topic might not be available when setting the metric hence I updated the type instead of updating the code and setting the topic.
@@ -883,9 +869,9 @@ export function getMetrics ( | |||
}, | |||
|
|||
onDuplicateMsgDelivery (topicStr: TopicStr, deliveryDelayMs: number, isLateDelivery: boolean): void { | |||
this.duplicateMsgDeliveryDelay.observe(deliveryDelayMs / 1000) | |||
const topic = this.toTopic(topicStr) | |||
this.duplicateMsgDeliveryDelay.observe({ topic }, deliveryDelayMs / 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Label was defined in type but not set. I'd assume this was just an oversight as topic is always available here.
086efa0
to
59bd077
Compare
See ChainSafe/lodestar#6201 for motivation / rationale