You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2021/11/11 12:52:36 UTC

[GitHub] [incubator-inlong] luchunliang opened a new pull request #1788: [Feature]Inlong-common provide monitor indicator #1786

luchunliang opened a new pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788


   [Feature]Inlong-common provide monitoring indicator reporting mechanism with JMX, user can implement the code that read the metrics and report to user-defined monitor system.
   
   Title Name: [INLONG-1786][component] [Feature]Inlong-common provide monitoring indicator reporting mechanism with JMX, user can implement the code that read the metrics and report to user-defined monitor system.
   Fixes #<1786>
   
   Motivation
   Inlong-common provide monitoring indicator reporting mechanism with JMX, user can implement the code that read the metrics and report to user-defined monitor system.
   Inlong-module can add monitor metric class that is the subclass of org.apache.inlong.commons.config.metrics.MetricItem, and register it to MBeanServer.
   User-defined plugin can get module metric with JMX, and report metric data to different monitor system.
   
   Test case1 of one metric item:
   org.apache.inlong.commons.config.metrics.item.TestMetricItemMBean
   Test case2 of a group of similar metric items:
   org.apache.inlong.commons.config.metrics.item.TestMetricItemSetMBean
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748067709



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItem.java
##########
@@ -0,0 +1,184 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * 
+ * MetricItem
+ */
+public class MetricItem implements MetricItemMBean {
+
+    private String key;
+    private Map<String, String> dimensions;
+    private Map<String, AtomicLong> countMetrics;
+    private Map<String, AtomicLong> gaugeMetrics;
+
+    /**
+     * getDimensionsKey
+     * 
+     * @return
+     */
+    @Override
+    public String getDimensionsKey() {
+        if (key != null) {
+            return key;
+        }
+        //
+        Map<String, String> dimensionMap = this.getDimensions();
+        this.key = MetricUtils.getDimensionsKey(dimensionMap);
+        return key;
+    }
+
+    /**
+     * getDimensions
+     * 
+     * @return
+     */
+    @Override
+    public Map<String, String> getDimensions() {
+        if (dimensions != null) {
+            return dimensions;
+        }
+        dimensions = new HashMap<>();
+
+        // get all fields
+        List<Field> fields = getDeclaredFieldsIncludingInherited(this.getClass());
+
+        // filter dimension fields
+        for (Field field : fields) {
+            field.setAccessible(true);
+            for (Annotation fieldAnnotation : field.getAnnotations()) {
+                if (fieldAnnotation instanceof Dimension) {
+                    Dimension dimension = (Dimension) fieldAnnotation;
+                    String name = dimension.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        String value = (fieldValue == null) ? "" : fieldValue.toString();
+                        dimensions.put(name, value);
+                    } catch (Throwable t) {
+                        t.printStackTrace();

Review comment:
       Fixed, change to print with Logger.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748069968



##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";
+    public static final String CONTAINER_NAME = "2222.atta.DataProxy.sz100001";
+    public static final String CONTAINER_IP = "127.0.0.1";
+    private static final String SOURCE_ID = "agent-source";
+    private static final String SOURCE_DATA_ID = "12069";
+    private static final String INLONG_GROUP_ID1 = "03a00000026";
+    private static final String INLONG_GROUP_ID2 = "03a00000126";
+    private static final String INLONG_STREAM_ID = "";
+    private static final String SINK_ID = "atta5th-pulsar-sz";
+    private static final String SINK_DATA_ID = "PULSAR_TOPIC_1";
+    private static DataProxyMetricItemSet itemSet;
+    private static Map<String, String> dimSource;
+    private static Map<String, String> dimSink;
+
+    /**
+     * setup
+     */
+    @BeforeClass
+    public static void setup() {
+        itemSet = DataProxyMetricItemSet.getInstance();
+        MetricRegister.register(itemSet);
+        // prepare
+        DataProxyMetricItem itemSource = new DataProxyMetricItem();
+        itemSource.setId = SET_ID;
+        itemSource.containerName = CONTAINER_NAME;
+        itemSource.containerIp = CONTAINER_IP;
+        itemSource.sourceId = SOURCE_ID;
+        itemSource.sourceDataId = SOURCE_DATA_ID;
+        itemSource.inlongGroupId = INLONG_GROUP_ID1;
+        itemSource.inlongStreamId = INLONG_STREAM_ID;
+        dimSource = itemSource.getDimensions();
+        //
+        DataProxyMetricItem itemSink = new DataProxyMetricItem();
+        itemSink.setId = SET_ID;
+        itemSink.containerName = CONTAINER_NAME;
+        itemSink.containerIp = CONTAINER_IP;
+        itemSink.sinkId = SINK_ID;
+        itemSink.sinkDataId = SINK_DATA_ID;
+        itemSink.inlongGroupId = INLONG_GROUP_ID1;
+        itemSink.inlongStreamId = INLONG_STREAM_ID;
+        dimSink = itemSink.getDimensions();
+    }
+
+    /**
+     * testResult
+     * 
+     * @throws Exception
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testResult() throws Exception {
+        // increase source
+        DataProxyMetricItem item = null;
+        item = itemSet.findMetricItem(dimSource);
+        item.readSuccessCount.incrementAndGet();
+        item.readSuccessSize.addAndGet(100);
+        String keySource1 = MetricUtils.getDimensionsKey(dimSource);
+        //
+        dimSource.put("inlongGroupId", INLONG_GROUP_ID2);
+        item = itemSet.findMetricItem(dimSource);
+        item.readFailCount.addAndGet(20);
+        item.readFailSize.addAndGet(2000);
+        String keySource2 = MetricUtils.getDimensionsKey(dimSource);
+        // increase sink
+        item = itemSet.findMetricItem(dimSink);
+        item.sendCount.incrementAndGet();
+        item.sendSize.addAndGet(100);
+        item.sendSuccessCount.incrementAndGet();
+        item.sendSuccessSize.addAndGet(100);
+        String keySink1 = MetricUtils.getDimensionsKey(dimSink);
+        //

Review comment:
       This is test unit code.
   Empty line will separate different code block for readability.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748061941



##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/DataProxyMetricItem.java
##########
@@ -0,0 +1,80 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.inlong.commons.config.metrics.CountMetric;
+import org.apache.inlong.commons.config.metrics.Dimension;
+import org.apache.inlong.commons.config.metrics.MetricDomain;
+import org.apache.inlong.commons.config.metrics.MetricItem;
+
+/**
+ * 
+ * DataProxyMetricItem

Review comment:
       This is test unit code of inlong-common.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748067295



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemSet.java
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 
+ * MetricItemSet

Review comment:
       No need auditor info in class define.
   This is an open source.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] aloyszhang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
aloyszhang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748050510



##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";
+    public static final String CONTAINER_NAME = "2222.atta.DataProxy.sz100001";
+    public static final String CONTAINER_IP = "127.0.0.1";
+    private static final String SOURCE_ID = "agent-source";
+    private static final String SOURCE_DATA_ID = "12069";
+    private static final String INLONG_GROUP_ID1 = "03a00000026";
+    private static final String INLONG_GROUP_ID2 = "03a00000126";
+    private static final String INLONG_STREAM_ID = "";
+    private static final String SINK_ID = "atta5th-pulsar-sz";
+    private static final String SINK_DATA_ID = "PULSAR_TOPIC_1";
+    private static DataProxyMetricItemSet itemSet;
+    private static Map<String, String> dimSource;
+    private static Map<String, String> dimSink;
+
+    /**
+     * setup
+     */
+    @BeforeClass
+    public static void setup() {
+        itemSet = DataProxyMetricItemSet.getInstance();
+        MetricRegister.register(itemSet);
+        // prepare
+        DataProxyMetricItem itemSource = new DataProxyMetricItem();
+        itemSource.setId = SET_ID;
+        itemSource.containerName = CONTAINER_NAME;
+        itemSource.containerIp = CONTAINER_IP;
+        itemSource.sourceId = SOURCE_ID;
+        itemSource.sourceDataId = SOURCE_DATA_ID;
+        itemSource.inlongGroupId = INLONG_GROUP_ID1;
+        itemSource.inlongStreamId = INLONG_STREAM_ID;
+        dimSource = itemSource.getDimensions();
+        //
+        DataProxyMetricItem itemSink = new DataProxyMetricItem();
+        itemSink.setId = SET_ID;
+        itemSink.containerName = CONTAINER_NAME;
+        itemSink.containerIp = CONTAINER_IP;
+        itemSink.sinkId = SINK_ID;
+        itemSink.sinkDataId = SINK_DATA_ID;
+        itemSink.inlongGroupId = INLONG_GROUP_ID1;
+        itemSink.inlongStreamId = INLONG_STREAM_ID;
+        dimSink = itemSink.getDimensions();
+    }
+
+    /**
+     * testResult
+     * 
+     * @throws Exception
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testResult() throws Exception {
+        // increase source
+        DataProxyMetricItem item = null;
+        item = itemSet.findMetricItem(dimSource);
+        item.readSuccessCount.incrementAndGet();
+        item.readSuccessSize.addAndGet(100);
+        String keySource1 = MetricUtils.getDimensionsKey(dimSource);
+        //
+        dimSource.put("inlongGroupId", INLONG_GROUP_ID2);
+        item = itemSet.findMetricItem(dimSource);
+        item.readFailCount.addAndGet(20);
+        item.readFailSize.addAndGet(2000);
+        String keySource2 = MetricUtils.getDimensionsKey(dimSource);
+        // increase sink
+        item = itemSet.findMetricItem(dimSink);
+        item.sendCount.incrementAndGet();
+        item.sendSize.addAndGet(100);
+        item.sendSuccessCount.incrementAndGet();
+        item.sendSuccessSize.addAndGet(100);
+        String keySink1 = MetricUtils.getDimensionsKey(dimSink);
+        //

Review comment:
       remove this empty line




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] gosonzhang merged pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
gosonzhang merged pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788


   


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] EMsnap commented on pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
EMsnap commented on pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#issuecomment-966887523


   LGTM


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748084148



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemMBean.java
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.Map;
+
+/**
+ * 
+ * MetricMBean
+ */
+public interface MetricItemMBean {
+
+    String METHOD_KEY = "getDimensionsKey";
+    String METHOD_DIMENSIONS = "getDimensions";
+    String METHOD_METRICS = "getMetrics";
+    char DOMAIN_SEPARATOR = ':';
+    char PROPERTY_SEPARATOR = ',';
+    char PROPERTY_EQUAL = '=';
+
+    /**
+     * getDimensionsKey
+     * 
+     * @return
+     */
+    String getDimensionsKey();

Review comment:
       Fill more comments in MBean class.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] inter12 commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
inter12 commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748035100



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemSet.java
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 
+ * MetricItemSet
+ */
+public abstract class MetricItemSet<T extends MetricItem> implements MetricItemSetMBean {
+
+    protected Map<String, T> itemMap = new ConcurrentHashMap<>();
+
+    /**
+     * createItem
+     * 
+     * @return
+     */
+    protected abstract T createItem();
+
+    /**
+     * findMetricItem
+     * 
+     * @param item
+     */
+    public T findMetricItem(Map<String, String> dimensions) {
+        String key = MetricUtils.getDimensionsKey(dimensions);
+        T currentItem = this.itemMap.get(key);
+        if (currentItem != null) {
+            return currentItem;
+        }
+        currentItem = createItem();
+        currentItem.setDimensions(dimensions);
+        T oldItem = this.itemMap.putIfAbsent(key, currentItem);
+        if (oldItem == null) {

Review comment:
       这里用三目表达式是否更好?

##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemSet.java
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 
+ * MetricItemSet

Review comment:
       这些类 不需要作者信息?

##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItem.java
##########
@@ -0,0 +1,184 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * 
+ * MetricItem
+ */
+public class MetricItem implements MetricItemMBean {
+
+    private String key;
+    private Map<String, String> dimensions;
+    private Map<String, AtomicLong> countMetrics;
+    private Map<String, AtomicLong> gaugeMetrics;
+
+    /**
+     * getDimensionsKey
+     * 
+     * @return
+     */
+    @Override
+    public String getDimensionsKey() {
+        if (key != null) {
+            return key;
+        }
+        //
+        Map<String, String> dimensionMap = this.getDimensions();
+        this.key = MetricUtils.getDimensionsKey(dimensionMap);
+        return key;
+    }
+
+    /**
+     * getDimensions
+     * 
+     * @return
+     */
+    @Override
+    public Map<String, String> getDimensions() {
+        if (dimensions != null) {
+            return dimensions;
+        }
+        dimensions = new HashMap<>();
+
+        // get all fields
+        List<Field> fields = getDeclaredFieldsIncludingInherited(this.getClass());
+
+        // filter dimension fields
+        for (Field field : fields) {
+            field.setAccessible(true);
+            for (Annotation fieldAnnotation : field.getAnnotations()) {
+                if (fieldAnnotation instanceof Dimension) {
+                    Dimension dimension = (Dimension) fieldAnnotation;
+                    String name = dimension.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        String value = (fieldValue == null) ? "" : fieldValue.toString();
+                        dimensions.put(name, value);
+                    } catch (Throwable t) {
+                        t.printStackTrace();

Review comment:
       直接print异常是否合适?

##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemMBean.java
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.Map;
+
+/**
+ * 
+ * MetricMBean
+ */
+public interface MetricItemMBean {
+
+    String METHOD_KEY = "getDimensionsKey";
+    String METHOD_DIMENSIONS = "getDimensions";
+    String METHOD_METRICS = "getMetrics";
+    char DOMAIN_SEPARATOR = ':';
+    char PROPERTY_SEPARATOR = ',';
+    char PROPERTY_EQUAL = '=';
+
+    /**
+     * getDimensionsKey
+     * 
+     * @return
+     */
+    String getDimensionsKey();

Review comment:
       方法的注释 是否可以更详细?

##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricValue.java
##########
@@ -0,0 +1,48 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+/**
+ * 
+ * MetricValue
+ */
+public class MetricValue {
+
+    public String name;

Review comment:
       属性是否应该private

##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItem.java
##########
@@ -0,0 +1,184 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * 
+ * MetricItem
+ */
+public class MetricItem implements MetricItemMBean {
+
+    private String key;
+    private Map<String, String> dimensions;
+    private Map<String, AtomicLong> countMetrics;
+    private Map<String, AtomicLong> gaugeMetrics;
+
+    /**
+     * getDimensionsKey
+     * 
+     * @return
+     */
+    @Override
+    public String getDimensionsKey() {
+        if (key != null) {
+            return key;
+        }
+        //
+        Map<String, String> dimensionMap = this.getDimensions();
+        this.key = MetricUtils.getDimensionsKey(dimensionMap);
+        return key;
+    }
+
+    /**
+     * getDimensions
+     * 
+     * @return
+     */
+    @Override
+    public Map<String, String> getDimensions() {
+        if (dimensions != null) {
+            return dimensions;
+        }
+        dimensions = new HashMap<>();
+
+        // get all fields
+        List<Field> fields = getDeclaredFieldsIncludingInherited(this.getClass());
+
+        // filter dimension fields
+        for (Field field : fields) {
+            field.setAccessible(true);
+            for (Annotation fieldAnnotation : field.getAnnotations()) {
+                if (fieldAnnotation instanceof Dimension) {
+                    Dimension dimension = (Dimension) fieldAnnotation;
+                    String name = dimension.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        String value = (fieldValue == null) ? "" : fieldValue.toString();
+                        dimensions.put(name, value);
+                    } catch (Throwable t) {
+                        t.printStackTrace();
+                    }
+                    break;
+                }
+            }
+        }
+        return dimensions;
+    }
+
+    /**
+     * set dimensions
+     * 
+     * @param dimensions the dimensions to set
+     */
+    public void setDimensions(Map<String, String> dimensions) {
+        this.dimensions = new HashMap<String, String>();
+        this.dimensions.putAll(dimensions);
+    }
+
+    /**
+     * snapshot
+     * 
+     * @return
+     */
+    @Override
+    public Map<String, MetricValue> snapshot() {
+        if (this.countMetrics == null || this.gaugeMetrics == null) {
+            this.initMetricField();
+        }
+        //
+        Map<String, MetricValue> metrics = new HashMap<>();
+        this.countMetrics.forEach((key, value) -> {
+            metrics.put(key, MetricValue.of(key, value.getAndSet(0)));
+        });
+        this.gaugeMetrics.forEach((key, value) -> {
+            metrics.put(key, MetricValue.of(key, value.get()));
+        });
+        return metrics;
+    }
+
+    /**
+     * initMetricField
+     */
+    protected void initMetricField() {
+        this.countMetrics = new HashMap<>();
+        this.gaugeMetrics = new HashMap<>();
+
+        // get all fields
+        List<Field> fields = getDeclaredFieldsIncludingInherited(this.getClass());
+
+        // filter metric fields
+        for (Field field : fields) {
+            field.setAccessible(true);
+            for (Annotation fieldAnnotation : field.getAnnotations()) {
+                if (fieldAnnotation instanceof CountMetric) {
+                    CountMetric countMetric = (CountMetric) fieldAnnotation;
+                    String name = countMetric.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        if (fieldValue instanceof AtomicLong) {
+                            this.countMetrics.put(name, (AtomicLong) fieldValue);
+                        }
+                    } catch (Throwable t) {
+                        t.printStackTrace();
+                    }
+                    break;
+                } else if (fieldAnnotation instanceof GaugeMetric) {
+                    GaugeMetric gaugeMetric = (GaugeMetric) fieldAnnotation;
+                    String name = gaugeMetric.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        if (fieldValue instanceof AtomicLong) {
+                            this.gaugeMetrics.put(name, (AtomicLong) fieldValue);
+                        }
+                    } catch (Throwable t) {
+                        t.printStackTrace();

Review comment:
       这个地方不能直接 输出异常




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] codecov-commenter edited a comment on pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#issuecomment-966923679


   # [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1788](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f906291) into [master](https://codecov.io/gh/apache/incubator-inlong/commit/246536f43cb0317a284e9924b1e24eafffd492b8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (246536f) will **increase** coverage by `0.02%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-inlong/pull/1788/graphs/tree.svg?width=650&height=150&src=pr&token=1EUK92O9K2&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1788      +/-   ##
   ============================================
   + Coverage     12.13%   12.16%   +0.02%     
   - Complexity     1044     1045       +1     
   ============================================
     Files           393      393              
     Lines         32805    32805              
     Branches       5157     5157              
   ============================================
   + Hits           3982     3990       +8     
   + Misses        28057    28051       -6     
   + Partials        766      764       -2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../producer/qltystats/DefaultBrokerRcvQltyStats.java](https://codecov.io/gh/apache/incubator-inlong/pull/1788/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pbmxvbmcvdHViZW1xL2NsaWVudC9wcm9kdWNlci9xbHR5c3RhdHMvRGVmYXVsdEJyb2tlclJjdlFsdHlTdGF0cy5qYXZh) | `45.70% <0.00%> (+0.39%)` | :arrow_up: |
   | [.../java/org/apache/flume/sink/tubemq/TubemqSink.java](https://codecov.io/gh/apache/incubator-inlong/pull/1788/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5sb25nLXR1YmVtcS90dWJlbXEtY29ubmVjdG9ycy90dWJlbXEtY29ubmVjdG9yLWZsdW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9mbHVtZS9zaW5rL3R1YmVtcS9UdWJlbXFTaW5rLmphdmE=) | `55.42% <0.00%> (+4.00%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [246536f...f906291](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] EMsnap commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
EMsnap commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748043335



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemSet.java
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 
+ * MetricItemSet

Review comment:
       no author info should be appeared in class def




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748063449



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItem.java
##########
@@ -0,0 +1,184 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * 
+ * MetricItem
+ */
+public class MetricItem implements MetricItemMBean {
+
+    private String key;
+    private Map<String, String> dimensions;
+    private Map<String, AtomicLong> countMetrics;
+    private Map<String, AtomicLong> gaugeMetrics;
+
+    /**
+     * getDimensionsKey
+     * 
+     * @return
+     */
+    @Override
+    public String getDimensionsKey() {
+        if (key != null) {
+            return key;
+        }
+        //
+        Map<String, String> dimensionMap = this.getDimensions();
+        this.key = MetricUtils.getDimensionsKey(dimensionMap);
+        return key;
+    }
+
+    /**
+     * getDimensions
+     * 
+     * @return
+     */
+    @Override
+    public Map<String, String> getDimensions() {
+        if (dimensions != null) {
+            return dimensions;
+        }
+        dimensions = new HashMap<>();
+
+        // get all fields
+        List<Field> fields = getDeclaredFieldsIncludingInherited(this.getClass());
+
+        // filter dimension fields
+        for (Field field : fields) {
+            field.setAccessible(true);
+            for (Annotation fieldAnnotation : field.getAnnotations()) {
+                if (fieldAnnotation instanceof Dimension) {
+                    Dimension dimension = (Dimension) fieldAnnotation;
+                    String name = dimension.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        String value = (fieldValue == null) ? "" : fieldValue.toString();
+                        dimensions.put(name, value);
+                    } catch (Throwable t) {
+                        t.printStackTrace();
+                    }
+                    break;
+                }
+            }
+        }
+        return dimensions;
+    }
+
+    /**
+     * set dimensions
+     * 
+     * @param dimensions the dimensions to set
+     */
+    public void setDimensions(Map<String, String> dimensions) {
+        this.dimensions = new HashMap<String, String>();
+        this.dimensions.putAll(dimensions);
+    }
+
+    /**
+     * snapshot
+     * 
+     * @return
+     */
+    @Override
+    public Map<String, MetricValue> snapshot() {
+        if (this.countMetrics == null || this.gaugeMetrics == null) {
+            this.initMetricField();
+        }
+        //
+        Map<String, MetricValue> metrics = new HashMap<>();
+        this.countMetrics.forEach((key, value) -> {
+            metrics.put(key, MetricValue.of(key, value.getAndSet(0)));
+        });
+        this.gaugeMetrics.forEach((key, value) -> {
+            metrics.put(key, MetricValue.of(key, value.get()));
+        });
+        return metrics;
+    }
+
+    /**
+     * initMetricField
+     */
+    protected void initMetricField() {
+        this.countMetrics = new HashMap<>();
+        this.gaugeMetrics = new HashMap<>();
+
+        // get all fields
+        List<Field> fields = getDeclaredFieldsIncludingInherited(this.getClass());
+
+        // filter metric fields
+        for (Field field : fields) {
+            field.setAccessible(true);
+            for (Annotation fieldAnnotation : field.getAnnotations()) {
+                if (fieldAnnotation instanceof CountMetric) {
+                    CountMetric countMetric = (CountMetric) fieldAnnotation;
+                    String name = countMetric.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        if (fieldValue instanceof AtomicLong) {
+                            this.countMetrics.put(name, (AtomicLong) fieldValue);
+                        }
+                    } catch (Throwable t) {
+                        t.printStackTrace();
+                    }
+                    break;
+                } else if (fieldAnnotation instanceof GaugeMetric) {
+                    GaugeMetric gaugeMetric = (GaugeMetric) fieldAnnotation;
+                    String name = gaugeMetric.name();
+                    name = (name != null && name.length() > 0) ? name : field.getName();
+                    try {
+                        Object fieldValue = field.get(this);
+                        if (fieldValue instanceof AtomicLong) {
+                            this.gaugeMetrics.put(name, (AtomicLong) fieldValue);
+                        }
+                    } catch (Throwable t) {
+                        t.printStackTrace();

Review comment:
       Fixed, change to print with Logger.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748076444



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricItemSet.java
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 
+ * MetricItemSet
+ */
+public abstract class MetricItemSet<T extends MetricItem> implements MetricItemSetMBean {
+
+    protected Map<String, T> itemMap = new ConcurrentHashMap<>();
+
+    /**
+     * createItem
+     * 
+     * @return
+     */
+    protected abstract T createItem();
+
+    /**
+     * findMetricItem
+     * 
+     * @param item
+     */
+    public T findMetricItem(Map<String, String> dimensions) {
+        String key = MetricUtils.getDimensionsKey(dimensions);
+        T currentItem = this.itemMap.get(key);
+        if (currentItem != null) {
+            return currentItem;
+        }
+        currentItem = createItem();
+        currentItem.setDimensions(dimensions);
+        T oldItem = this.itemMap.putIfAbsent(key, currentItem);
+        if (oldItem == null) {

Review comment:
       好,改成三目表达式
           T returnItem = (oldItem == null) ? currentItem : oldItem;
           return returnItem;




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748061401



##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";
+    public static final String CONTAINER_NAME = "2222.atta.DataProxy.sz100001";
+    public static final String CONTAINER_IP = "127.0.0.1";
+    private static final String SOURCE_ID = "agent-source";
+    private static final String SOURCE_DATA_ID = "12069";
+    private static final String INLONG_GROUP_ID1 = "03a00000026";
+    private static final String INLONG_GROUP_ID2 = "03a00000126";
+    private static final String INLONG_STREAM_ID = "";
+    private static final String SINK_ID = "atta5th-pulsar-sz";

Review comment:
       fixed




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] dockerzhang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
dockerzhang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r747979922



##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";
+    public static final String CONTAINER_NAME = "2222.atta.DataProxy.sz100001";

Review comment:
       ditto

##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";

Review comment:
       it's better to change 'atta' -> 'inlong'.

##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";
+    public static final String CONTAINER_NAME = "2222.atta.DataProxy.sz100001";
+    public static final String CONTAINER_IP = "127.0.0.1";
+    private static final String SOURCE_ID = "agent-source";
+    private static final String SOURCE_DATA_ID = "12069";
+    private static final String INLONG_GROUP_ID1 = "03a00000026";
+    private static final String INLONG_GROUP_ID2 = "03a00000126";
+    private static final String INLONG_STREAM_ID = "";
+    private static final String SINK_ID = "atta5th-pulsar-sz";

Review comment:
       ditto

##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/DataProxyMetricItem.java
##########
@@ -0,0 +1,80 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.inlong.commons.config.metrics.CountMetric;
+import org.apache.inlong.commons.config.metrics.Dimension;
+import org.apache.inlong.commons.config.metrics.MetricDomain;
+import org.apache.inlong.commons.config.metrics.MetricItem;
+
+/**
+ * 
+ * DataProxyMetricItem

Review comment:
       do we need to move all 'dataProxyMetrics' classes to 'inlong-dataproxy' module?




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] codecov-commenter commented on pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#issuecomment-966923679


   # [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1788](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (64d4242) into [master](https://codecov.io/gh/apache/incubator-inlong/commit/246536f43cb0317a284e9924b1e24eafffd492b8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (246536f) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-inlong/pull/1788/graphs/tree.svg?width=650&height=150&src=pr&token=1EUK92O9K2&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #1788   +/-   ##
   =========================================
     Coverage     12.13%   12.13%           
     Complexity     1044     1044           
   =========================================
     Files           393      393           
     Lines         32805    32805           
     Branches       5157     5157           
   =========================================
     Hits           3982     3982           
     Misses        28057    28057           
     Partials        766      766           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [246536f...64d4242](https://codecov.io/gh/apache/incubator-inlong/pull/1788?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748068762



##########
File path: inlong-common/src/main/java/org/apache/inlong/commons/config/metrics/MetricValue.java
##########
@@ -0,0 +1,48 @@
+/**
+ * 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.inlong.commons.config.metrics;
+
+/**
+ * 
+ * MetricValue
+ */
+public class MetricValue {
+
+    public String name;

Review comment:
       Pojo object can have public field.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #1788: [INLONG-1786] Inlong-common provide monitor indicator #1786

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-inlong/pull/1788#discussion_r748060968



##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";

Review comment:
       fixed

##########
File path: inlong-common/src/test/java/org/apache/inlong/commons/config/metrics/set/TestMetricItemSetMBean.java
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.inlong.commons.config.metrics.set;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.inlong.commons.config.metrics.MetricItem;
+import org.apache.inlong.commons.config.metrics.MetricItemMBean;
+import org.apache.inlong.commons.config.metrics.MetricRegister;
+import org.apache.inlong.commons.config.metrics.MetricUtils;
+import org.apache.inlong.commons.config.metrics.MetricValue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ * TestMetricItemSetMBean
+ */
+public class TestMetricItemSetMBean {
+
+    public static final String SET_ID = "atta5th_sz";
+    public static final String CONTAINER_NAME = "2222.atta.DataProxy.sz100001";

Review comment:
       fixed




-- 
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: commits-unsubscribe@inlong.apache.org

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