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 2022/10/31 09:07:30 UTC

[GitHub] [inlong] luchunliang commented on a diff in pull request #6334: [INLONG-6331][Dataproxy] To fix dataproxy prometheus problem

luchunliang commented on code in PR #6334:
URL: https://github.com/apache/inlong/pull/6334#discussion_r1009177480


##########
inlong-dataproxy/dataproxy-source/src/main/java/org/apache/inlong/dataproxy/metrics/prometheus/PrometheusMetricListener.java:
##########
@@ -179,31 +175,33 @@ public void snapshot(String domain, List<MetricItemValue> itemValues) {
     public List<MetricFamilySamples> collect() {
 
         // total
-        CounterMetricFamily totalCounter = new CounterMetricFamily(metricName + "&group=total",
+        CounterMetricFamily totalCounter = new CounterMetricFamily(metricName,

Review Comment:
   Is it OK to change metric name?



##########
inlong-dataproxy/dataproxy-source/src/main/java/org/apache/inlong/dataproxy/metrics/prometheus/PrometheusMetricListener.java:
##########
@@ -179,31 +175,33 @@ public void snapshot(String domain, List<MetricItemValue> itemValues) {
     public List<MetricFamilySamples> collect() {
 
         // total
-        CounterMetricFamily totalCounter = new CounterMetricFamily(metricName + "&group=total",
+        CounterMetricFamily totalCounter = new CounterMetricFamily(metricName,
                 "The metrics of dataproxy node.",
                 Arrays.asList("dimension"));
         totalCounter.addMetric(Arrays.asList(M_READ_SUCCESS_COUNT), metricItem.readSuccessCount.get());
         totalCounter.addMetric(Arrays.asList(M_READ_SUCCESS_SIZE), metricItem.readSuccessSize.get());
         totalCounter.addMetric(Arrays.asList(M_READ_FAIL_COUNT), metricItem.readFailCount.get());
         totalCounter.addMetric(Arrays.asList(M_READ_FAIL_SIZE), metricItem.readFailSize.get());
-        //
+        // send
         totalCounter.addMetric(Arrays.asList(M_SEND_COUNT), metricItem.sendCount.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_SIZE), metricItem.sendSize.get());
-        //
         totalCounter.addMetric(Arrays.asList(M_SEND_SUCCESS_COUNT), metricItem.sendSuccessCount.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_SUCCESS_SIZE), metricItem.sendSuccessSize.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_FAIL_COUNT), metricItem.sendFailCount.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_FAIL_SIZE), metricItem.sendFailSize.get());
-        //
+        // duration
         totalCounter.addMetric(Arrays.asList(M_SINK_DURATION), metricItem.sinkDuration.get());
         totalCounter.addMetric(Arrays.asList(M_NODE_DURATION), metricItem.nodeDuration.get());
         totalCounter.addMetric(Arrays.asList(M_WHOLE_DURATION), metricItem.wholeDuration.get());
         List<MetricFamilySamples> mfs = new ArrayList<>();
         mfs.add(totalCounter);
 
         // id dimension
-        CounterMetricFamily idCounter = new CounterMetricFamily(metricName + "&group=id",
-                "The metrics of inlong datastream.", this.dimensionKeys);
+        List<String> dimensionIdKeys = new ArrayList<>();
+        dimensionIdKeys.add(DEFAULT_DIMENSION_LABEL);
+        dimensionIdKeys.addAll(this.dimensionKeys);
+        CounterMetricFamily idCounter = new CounterMetricFamily(metricName + "_id",

Review Comment:
   Is it OK to change metric name?



##########
inlong-dataproxy/dataproxy-source/src/main/java/org/apache/inlong/dataproxy/metrics/prometheus/PrometheusMetricListener.java:
##########
@@ -179,31 +175,33 @@ public void snapshot(String domain, List<MetricItemValue> itemValues) {
     public List<MetricFamilySamples> collect() {
 
         // total
-        CounterMetricFamily totalCounter = new CounterMetricFamily(metricName + "&group=total",
+        CounterMetricFamily totalCounter = new CounterMetricFamily(metricName,
                 "The metrics of dataproxy node.",
                 Arrays.asList("dimension"));
         totalCounter.addMetric(Arrays.asList(M_READ_SUCCESS_COUNT), metricItem.readSuccessCount.get());
         totalCounter.addMetric(Arrays.asList(M_READ_SUCCESS_SIZE), metricItem.readSuccessSize.get());
         totalCounter.addMetric(Arrays.asList(M_READ_FAIL_COUNT), metricItem.readFailCount.get());
         totalCounter.addMetric(Arrays.asList(M_READ_FAIL_SIZE), metricItem.readFailSize.get());
-        //
+        // send
         totalCounter.addMetric(Arrays.asList(M_SEND_COUNT), metricItem.sendCount.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_SIZE), metricItem.sendSize.get());
-        //
         totalCounter.addMetric(Arrays.asList(M_SEND_SUCCESS_COUNT), metricItem.sendSuccessCount.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_SUCCESS_SIZE), metricItem.sendSuccessSize.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_FAIL_COUNT), metricItem.sendFailCount.get());
         totalCounter.addMetric(Arrays.asList(M_SEND_FAIL_SIZE), metricItem.sendFailSize.get());
-        //
+        // duration
         totalCounter.addMetric(Arrays.asList(M_SINK_DURATION), metricItem.sinkDuration.get());
         totalCounter.addMetric(Arrays.asList(M_NODE_DURATION), metricItem.nodeDuration.get());
         totalCounter.addMetric(Arrays.asList(M_WHOLE_DURATION), metricItem.wholeDuration.get());
         List<MetricFamilySamples> mfs = new ArrayList<>();
         mfs.add(totalCounter);
 
         // id dimension
-        CounterMetricFamily idCounter = new CounterMetricFamily(metricName + "&group=id",
-                "The metrics of inlong datastream.", this.dimensionKeys);
+        List<String> dimensionIdKeys = new ArrayList<>();
+        dimensionIdKeys.add(DEFAULT_DIMENSION_LABEL);
+        dimensionIdKeys.addAll(this.dimensionKeys);

Review Comment:
   this.dimensionKeys is always empty.



-- 
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