divijvaidya commented on code in PR #12045:
URL: https://github.com/apache/kafka/pull/12045#discussion_r862908241


##########
clients/src/main/java/org/apache/kafka/common/metrics/stats/SampledStat.java:
##########
@@ -110,25 +127,40 @@ public String toString() {
     protected void purgeObsoleteSamples(MetricConfig config, long now) {
         long expireAge = config.samples() * config.timeWindowMs();
         for (Sample sample : samples) {
-            if (now - sample.lastWindowMs >= expireAge)
+            if (now - sample.getLastWindowMs() >= expireAge)
                 sample.reset(now);
         }
     }
 
     protected static class Sample {
-        public double initialValue;
-        public long eventCount;
-        public long lastWindowMs;
-        public double value;
+        private double initialValue;
+        private long eventCount;
+        private long lastWindowMs;
+        private double value;
+
+        /**
+         * A Sample object could be re-used in a ring buffer to store future 
samples for space efficiency.
+         * Thus, a sample could be in either of the following lifecycle states:
+         * NOT_INITIALIZED: Sample has not been initialized.
+         * ACTIVE: Sample has values and is currently
+         * RESET: Sample has been reset and the object is not destroyed so 
that it could be used for storing future
+         *        samples.
+         */
+        private enum LifecycleState {

Review Comment:
   This code has been removed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to