Interface LatencyTracker

All Known Implementing Classes:
EwmaLatencyTracker

@InternalApi @BetaApi public interface LatencyTracker
Interface for tracking latency scores of Spanner servers.

Implementations must be thread-safe as instances may be shared across multiple concurrent operations.

  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the current latency score.
    void
    Records an error and applies a latency penalty.
    void
    update(Duration latency)
    Updates the latency score with a new observation.
  • Method Details

    • getScore

      double getScore()
      Returns the current latency score.
      Returns:
      the latency score, where lower is better.
    • update

      void update(Duration latency)
      Updates the latency score with a new observation.
      Parameters:
      latency - the observed latency.
    • recordError

      void recordError(Duration penalty)
      Records an error and applies a latency penalty.
      Parameters:
      penalty - the penalty to apply.