Class ServerReadQuotaUsageStats

java.lang.Object
com.linkedin.venice.stats.AbstractVeniceStats
com.linkedin.venice.stats.ServerReadQuotaUsageStats

public class ServerReadQuotaUsageStats extends AbstractVeniceStats
For measuring quota requests and rejections for a given store. Specifically not using VeniceVersionedStats due to sophisticated needs: 1. Only requestedQPS, requestedKPS, and (usageRatio) nodeKpsResponsibility need to be versioned. We'd still like to report rejections at the store level, regardless if it came from current or backup version due to stale routing. 2. VeniceVersionedStats is tracking current and future. However, for the purpose of quota we only care about current and backup.

OTel metrics use high-perf async counters (ASYNC_COUNTER_FOR_HIGH_PERF_CASES) with outcome + version role dimensions, recorded separately from Tehuti sensors. Tehuti sensors are unversioned (no role dimension) so they are recorded directly, not via joint API.

  • Constructor Details

    • ServerReadQuotaUsageStats

      public ServerReadQuotaUsageStats(io.tehuti.metrics.MetricsRepository metricsRepository, String name, Time time, String clusterName)
  • Method Details

    • updateVersionInfo

      public void updateVersionInfo(int currentVersion, int backupVersion)
      Atomically updates both current and backup version numbers. This replaces the volatile ServerReadQuotaUsageStats.QuotaVersionInfo reference in a single write, matching the pattern used by IngestionOtelStats.updateVersionInfo(int, int).
    • getCurrentVersion

      public int getCurrentVersion()
    • getBackupVersion

      public int getBackupVersion()
    • removeVersion

      public void removeVersion(int version)
    • recordAllowed

      public void recordAllowed(int version, long rcu)
      Parameters:
      rcu - The number of Read Capacity Units that the allowed request cost
    • recordRejected

      public void recordRejected(int version, long rcu)
      Parameters:
      rcu - The number of Read Capacity Units that the rejected request would have cost
    • recordAllowedUnintentionally

      public void recordAllowedUnintentionally(int version, long rcu)
      Records requests that were allowed without quota check (quota enforcer not yet initialized or rate limiter not yet allocated for the resource).

      Note: OTel records both request count and key count for this outcome. Tehuti records only key count (no request count sensor exists for unintentionally allowed requests). This is an intentional enrichment — OTel provides strictly more granularity than Tehuti here.

      Parameters:
      version - The version number being accessed
      rcu - The number of Read Capacity Units that the request cost
    • setNodeQuotaResponsibility

      public void setNodeQuotaResponsibility(int version, long nodeKpsResponsibility)