code: private void checkQuotas(long timeMs, boolean preCheck, double requestedValue) {
          for (int i = 0; i < this.metrics.size(); i++) {
              TehutiMetric metric = this.metrics.get(i);
              MetricConfig config = metric.config();
              if (config != null) {
                  Quota quota = config.quota();
                  if (quota != null) {
                      // Only check the quota on the right time. If quota is set to check quota before recording,
                      // only verify the usage in pre-check round.
                      if (quota.isCheckQuotaBeforeRecording() ^ preCheck) {
                          continue;
                      }
                      // If we check quota before recording, we should count on the value of the current request.
                      // So we could prevent the usage of current request exceeding the quota.
                      double value = preCheck? metric.extraValue(timeMs, requestedValue): metric.value(timeMs);
                      if (!quota.acceptable(value)) {
                          throw new QuotaViolationException(
                              "Metric " + metric.name() + " is in violation of its " + quota.toString(), value);
                      }
                  }
              }
          }
      }
docs: Check if we have violated our quota for any metric that has a configured quota
  @param timeMs The current POSIX time in milliseconds