Skip to content

feat: type safe metric labels#479

Merged
wemeetagain merged 1 commit intomasterfrom
nflaig/type-safe-metric-labels
Jan 8, 2024
Merged

feat: type safe metric labels#479
wemeetagain merged 1 commit intomasterfrom
nflaig/type-safe-metric-labels

Conversation

@nflaig
Copy link
Copy Markdown
Member

@nflaig nflaig commented Jan 3, 2024

See ChainSafe/lodestar#6201 for motivation / rationale

@nflaig nflaig requested a review from a team as a code owner January 3, 2024 10:06
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 3, 2024

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.37%. Comparing base (eb53ea9) to head (59bd077).
⚠️ Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
src/metrics.ts 80.00% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}),

asyncValidationDelayFromFirstSeenSec: register.histogram<{ topic: TopicLabel }>({
asyncValidationDelayFromFirstSeenSec: register.histogram({
Copy link
Copy Markdown
Member Author

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

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.

onDuplicateMsgDelivery (topicStr: TopicStr, deliveryDelayMs: number, isLateDelivery: boolean): void {
this.duplicateMsgDeliveryDelay.observe(deliveryDelayMs / 1000)
const topic = this.toTopic(topicStr)
this.duplicateMsgDeliveryDelay.observe({ topic }, deliveryDelayMs / 1000)
Copy link
Copy Markdown
Member Author

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.

@nflaig nflaig changed the title refactor: type safe metric labels feat: type safe metric labels Jan 3, 2024
@nflaig nflaig force-pushed the nflaig/type-safe-metric-labels branch from 086efa0 to 59bd077 Compare January 3, 2024 10:15
@nflaig nflaig changed the title feat: type safe metric labels chore: type safe metric labels Jan 3, 2024
@nflaig nflaig changed the title chore: type safe metric labels feat: type safe metric labels Jan 3, 2024
@wemeetagain wemeetagain merged commit 67c2a55 into master Jan 8, 2024
@wemeetagain wemeetagain deleted the nflaig/type-safe-metric-labels branch January 8, 2024 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants