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

Migrate to nanoTime for time* methods, improve API DX #6

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

migesok
Copy link
Contributor

@migesok migesok commented Aug 30, 2024

timeFunc and timeFuture used millisecond precision, which lead to issues like Summary quantiles being skewed towards 0 if measured latencies are close to 1 ms.

To fix that:

  • time* methods use System.nanoTime() now
  • deprecate specific time*Nano methods, millisecond precision shouldn't be a choice to avoid mistakes
  • improve method naming, document all time-related public functionality
  • deprecate unused TemporalOps implicit conversion
  • overall developer experience improvements

This change breaks source compatibility for some usages, but binary compatibility is preserved.

@migesok migesok requested a review from mr-git August 30, 2024 15:17
@coveralls
Copy link

coveralls commented Aug 30, 2024

Pull Request Test Coverage Report for Build 10678212513

Details

  • 20 of 45 (44.44%) changed or added relevant lines in 3 files are covered.
  • 12 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+14.8%) to 43.396%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main/scala/com/evolutiongaming/prometheus/HasObserve.scala 0 1 0.0%
src/main/scala/com/evolutiongaming/prometheus/PrometheusHelper.scala 0 7 0.0%
src/main/scala/com/evolutiongaming/prometheus/ObserveDuration.scala 20 37 54.05%
Files with Coverage Reduction New Missed Lines %
src/main/scala/com/evolutiongaming/prometheus/ClockPlatform.scala 1 0.0%
src/main/scala/com/evolutiongaming/prometheus/PrometheusHelper.scala 11 0.0%
Totals Coverage Status
Change from base Build 10632764228: 14.8%
Covered Lines: 23
Relevant Lines: 53

💛 - Coveralls

timeFunc and timeFuture used millisecond precision, which lead to issues like
Summary quantiles being skewed towards 0 if measured latencies are close to 1 ms.

To fix that:
- time* methods use System.nanoTime() now
- deprecate specific time*Nano methods, millisecond precision shouldn't be a choice to avoid mistakes
- improve method naming, document all time-related public functionality
- deprecate unused TemporalOps implicit conversion
- overall developer experience improvements

This change breaks source compatibility for some usages, but binary compatibility is preserved.
@migesok migesok force-pushed the bugfix/use-nanotime-by-default branch from 671f18b to fecdce8 Compare September 3, 2024 07:09
@migesok migesok merged commit 7dd29e2 into master Sep 3, 2024
4 of 5 checks passed
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