junrao commented on code in PR #16949: URL: https://github.com/apache/kafka/pull/16949#discussion_r1739412072
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/metrics/HdrHistogram.java: ########## @@ -0,0 +1,145 @@ +/* + * 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.kafka.coordinator.group.metrics; + +import org.HdrHistogram.Histogram; +import org.HdrHistogram.Recorder; +import org.HdrHistogram.ValueRecorder; + +import java.util.concurrent.atomic.AtomicReference; + +/** + * <p>A wrapper on top of the HdrHistogram API. It handles writing to the histogram by delegating + * to an internal {@link ValueRecorder} implementation, and reading from the histogram by + * efficiently implementing the retrieval of up-to-date histogram data. + * + * <p>Note that all APIs expect a timestamp which is used by the histogram to discard decaying data + * and determine when the snapshot from which the histogram metrics are calculated should be + * refreshed. + */ +public final class HdrHistogram { Review Comment: Historically, we have been using the histogram in Yammer metric on the server side. Is there a particular reason that we want to introduce HdrHistogram? It would be use to add some comments to guide future developers on which histogram metric to use. -- 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