Skip to content
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

Use monotonic timers for metrics #1739

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Use monotonic timers for metrics #1739

merged 2 commits into from
Jan 19, 2024

Conversation

javitonino
Copy link
Contributor

@javitonino javitonino commented Jan 18, 2024

Description

A lot of metrics were using SystemTime when it's more appropriate to use Instant for measuring elapsed time. This PR changes all of those to use Instant.

It does not change it in some places where it was persisted to disk and compared across executions.

Of particular note: https://github.com/nuclia/nucliadb/compare/monotonic-timers?expand=1#diff-9da5113fe7de5eb5858d773e4e90b81a2f8abeaff96517361fd3e2f3c9cc8fb4L352 which could panic the replication process when measuring time across a time-discontinuity (usually due to a NTP clock adjustment).

This PR might just be the results of a regex search/replace and some manual review. 🙄

How was this PR tested?

Describe how you tested this PR.

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4b7ab33) 82.19% compared to head (6f60423) 82.20%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1739   +/-   ##
=======================================
  Coverage   82.19%   82.20%           
=======================================
  Files         335      336    +1     
  Lines       19592    19609   +17     
=======================================
+ Hits        16104    16119   +15     
- Misses       3488     3490    +2     
Flag Coverage Δ
ingest 69.05% <ø> (ø)
node-sidecar 95.39% <ø> (ø)
nucliadb 70.35% <ø> (+0.02%) ⬆️
reader 79.41% <ø> (ø)
sdk 40.58% <ø> (ø)
search 79.04% <ø> (ø)
standalone 88.29% <ø> (ø)
train 63.71% <ø> (ø)
utils 81.25% <ø> (ø)
writer 85.15% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

debug!("{id:?} - Indexing document: starts at {v} ms");
}
let v = time.elapsed().as_millis();
debug!("{id:?} - Indexing document: starts at {v} ms");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should say "ends" not "starts", was already wrong before.

Copy link
Contributor

@hermeGarcia hermeGarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just one comment.

@javitonino javitonino merged commit 02b3992 into main Jan 19, 2024
104 of 105 checks passed
@javitonino javitonino deleted the monotonic-timers branch January 19, 2024 09:08
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.

2 participants