Package io.opentelemetry.android
Class OtelAndroidClock
-
- All Implemented Interfaces:
-
io.opentelemetry.sdk.common.Clock
public final class OtelAndroidClock implements ClockAn implementation of Clock that takes a baseline by subtracting SystemClock.elapsedRealtimeNanos from the best available wall time and then adds that baseline to SystemClock.elapsedRealtimeNanos to provide a monotonic wall-clock time.
When selecting the anchor clock we try (in order):
This avoids the downside of System.currentTimeMillis not being monotonic on Android (i.e. the clock doesn't consistently tick when the process is in the background or cached). It also avoids the problem of SystemClock.elapsedRealtimeNanos not providing wall-clock time.
-
-
Constructor Summary
Constructors Constructor Description OtelAndroidClock(Boolean isGnssAnchorEnabled, Boolean isNetworkAnchorEnabled)OtelAndroidClock(Boolean isGnssAnchorEnabled)OtelAndroidClock()
-