apoorvmittal10 commented on code in PR #14575:
URL: https://github.com/apache/kafka/pull/14575#discussion_r1365904474


##########
clients/src/main/java/org/apache/kafka/common/telemetry/emitter/Emitter.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.common.telemetry.emitter;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.kafka.common.telemetry.metrics.MetricKey;
+import org.apache.kafka.common.telemetry.metrics.MetricKeyable;
+import org.apache.kafka.common.telemetry.metrics.SinglePointMetric;
+
+import java.io.Closeable;
+
+/**
+ * An {@code Emitter} emits the values held by the {@link SinglePointMetric}, 
likely first converting them
+ * to a format suitable for exposure, storage, or transmission. The telemetry 
reporter is likely
+ * the entity that is familiar with the underlying method of making the 
metrics visible to the
+ * broker. Thus, it is the primary place in the code where the implementation 
details are known.
+ *
+ * <p/>
+ *
+ * An {@code Emitter} is stateless and the telemetry reporter should assume 
that the object is
+ * not thread safe and thus concurrent access to either the
+ * {@link #shouldEmitMetric(MetricKeyable)} or {@link 
#emitMetric(SinglePointMetric)} should be avoided.
+ *
+ * Regarding threading, the {@link #init()} and {@link #close()} methods may 
be called from
+ * different threads and so proper care should be taken by implementations of 
the
+ * {@code MetricsCollector} interface to be thread-safe. However, the 
telemetry reporter must
+ * ensure that the {@link #emitMetric(SinglePointMetric)} method should only 
be invoked in a synchronous
+ * manner.
+ */
+public interface Emitter extends Closeable {

Review Comment:
   Moved.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to