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

OutlierDetection should use Ticker, not TimeProvider #11622

Open
ejona86 opened this issue Oct 17, 2024 · 0 comments
Open

OutlierDetection should use Ticker, not TimeProvider #11622

ejona86 opened this issue Oct 17, 2024 · 0 comments
Milestone

Comments

@ejona86
Copy link
Member

ejona86 commented Oct 17, 2024

TimeProvider provides wall time. That can move forward and backward as time is adjusted. OutlierDetection is measuring durations, so it should use a monotonic clock. We use Ticker (either Guava's or Deadline's, but generally Guava's) for that. FakeClock supports both for testing.

Doing a quick audit, this seems to be the only present incorrect use of TimeProvider.

I feel like I noticed this before, but I don't know why I didn't change it at the time. Maybe I had wanted to change the weird Long usage as well. (E.g., EPOCH = currentTimeNanos() - 1 and use EPOCH instead of null.)

CC @kannanjgithub

@ejona86 ejona86 added this to the Next milestone Oct 17, 2024
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

No branches or pull requests

1 participant