d-c-manning commented on code in PR #2169:
URL: https://github.com/apache/phoenix/pull/2169#discussion_r2136708124


##########
phoenix-core-client/src/main/java/org/apache/phoenix/monitoring/PercentileHistogramDistribution.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.monitoring;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap;
+
+/**
+ * Exposes percentiles captured using {@link PercentileHistogram} to the 
consumers w/o exposing
+ * underlying {@link org.HdrHistogram.Histogram} instances.
+ * <br/><br/>
+ * Call {@link #getPercentileDistributionMap()} to get percentile distribution 
from the histogram
+ * . Call {@link #getTags()} to get the tags attached to the histogram.
+ */
+public class PercentileHistogramDistribution extends HistogramDistributionImpl 
{
+    private final ImmutableMap<String, Long> percentileDistributionMap;
+    private ImmutableMap<String, String> tags = null;
+
+    public PercentileHistogramDistribution(String histoName, long min, long 
max, long count,
+                                           Map<String, Long> 
percentileDistributionMap) {
+        super(histoName, min, max, count, Collections.emptyMap());
+        this.percentileDistributionMap = 
ImmutableMap.copyOf(percentileDistributionMap);
+    }
+
+    public PercentileHistogramDistribution(String histoName, long min, long 
max, long count,
+                                           Map<String, Long> 
percentileDistributionMap,
+                                           Map<String, String> tags) {
+        this(histoName, min, max, count, percentileDistributionMap);
+        this.tags = ImmutableMap.copyOf(tags);
+    }
+
+    public Map<String, Long> getPercentileDistributionMap() {
+        return percentileDistributionMap;
+    }
+
+    public Map<String, Long> getRangeDistributionMap() {
+        throw new UnsupportedOperationException("Range Histogram Distribution 
is not supported!!");

Review Comment:
   can we support it?
   
   For process-lifetime histogram aggregations, they lose their value the 
longer the process runs. After 1,000,000 operations, the next operation isn't 
going to appreciably change percentiles, but you may want to know which bin 
that operation was in.
   
   If you have the range distributions (bin counts), then you can at least 
observe which bin(s) increased in count since the last time we recorded the 
metrics.
   
   Alternatively, we could provide a way for the caller to clear the underlying 
histogram, but that relies on the caller knowing when it is an "interesting" 
time to reset the histogram, which the caller may not know in advance.



-- 
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: issues-unsubscr...@phoenix.apache.org

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

Reply via email to