grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

OutlierDetection should use Ticker, not TimeProvider

Open ejona86 opened this issue 1 year ago • 0 comments

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 avatar Oct 17 '24 15:10 ejona86