EMsnap commented on code in PR #4855:
URL: https://github.com/apache/inlong/pull/4855#discussion_r914560871
##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/AbstractReader.java:
##########
@@ -17,66 +17,57 @@
package org.apache.inlong.agent.plugin.sources.reader;
-import com.google.common.base.Joiner;
import org.apache.inlong.agent.conf.JobProfile;
import org.apache.inlong.agent.plugin.Reader;
-import org.apache.inlong.agent.plugin.metrics.PluginJmxMetric;
-import org.apache.inlong.agent.plugin.metrics.PluginMetric;
-import org.apache.inlong.agent.plugin.metrics.PluginPrometheusMetric;
-import org.apache.inlong.agent.utils.ConfigUtil;
-
-import java.util.concurrent.atomic.AtomicLong;
import static
org.apache.inlong.agent.constant.CommonConstants.DEFAULT_PROXY_INLONG_GROUP_ID;
import static
org.apache.inlong.agent.constant.CommonConstants.DEFAULT_PROXY_INLONG_STREAM_ID;
-import static
org.apache.inlong.agent.constant.CommonConstants.KEY_METRICS_INDEX;
import static
org.apache.inlong.agent.constant.CommonConstants.PROXY_INLONG_GROUP_ID;
import static
org.apache.inlong.agent.constant.CommonConstants.PROXY_INLONG_STREAM_ID;
-import static
org.apache.inlong.agent.constant.CommonConstants.PROXY_KEY_GROUP_ID;
-import static
org.apache.inlong.agent.constant.CommonConstants.PROXY_KEY_STREAM_ID;
/**
* abstract reader, init reader and reader metrics
*/
public abstract class AbstractReader implements Reader {
- protected static PluginMetric readerMetric;
- protected static PluginMetric streamMetric;
- private static AtomicLong metricsIndex = new AtomicLong(0);
protected String inlongGroupId;
protected String inlongStreamId;
+ protected String metricTagName;
@Override
public void init(JobProfile jobConf) {
inlongGroupId = jobConf.get(PROXY_INLONG_GROUP_ID,
DEFAULT_PROXY_INLONG_GROUP_ID);
inlongStreamId = jobConf.get(PROXY_INLONG_STREAM_ID,
DEFAULT_PROXY_INLONG_STREAM_ID);
}
- /**
- * init reader metrics
- *
- * @param tagName metric tagName
- */
- protected void intMetric(String tagName) {
- String metricsIndexValue =
String.valueOf(metricsIndex.getAndIncrement());
- String label = Joiner.on(",").join(tagName, metricsIndexValue);
- String groupIdKV = PROXY_KEY_GROUP_ID + "=" + inlongGroupId;
- String streamIdKV = PROXY_KEY_STREAM_ID + "=" + inlongStreamId;
- String metricsIndexKV = KEY_METRICS_INDEX + "=" + metricsIndexValue;
- if (ConfigUtil.isPrometheusEnabled()) {
- readerMetric = new PluginPrometheusMetric(label);
- } else {
- label = Joiner.on(",").join(tagName, metricsIndexKV);
- readerMetric = new PluginJmxMetric(label);
- }
- label = Joiner.on(",").join(tagName, inlongGroupId, inlongStreamId);
- if (ConfigUtil.isPrometheusEnabled()) {
- streamMetric = new PluginPrometheusMetric(label);
- } else {
- label = Joiner.on(",").join(tagName, groupIdKV, streamIdKV);
- streamMetric = new PluginJmxMetric(label);
- }
+ public String getInlongGroupId() {
+ return inlongGroupId;
}
+// /**
+// * init reader metrics
Review Comment:
please remove code if useless
--
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]