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/17 12:41:39 UTC

[GitHub] [inlong] Keylchen opened a new pull request, #6195: [INLONG-6194][Agent] Support different components to parse their related metric.

Keylchen opened a new pull request, #6195:
URL: https://github.com/apache/inlong/pull/6195

   ### Prepare a Pull Request
   Support different components to parse their related metric.
   
   - Fixes #6194 
   
   ### Motivation
   
   Because the metrics uploaded by different agent components may be different, I split the metric item id_counter of prometheus and use KEY_PLUGIN_ID or KEY_COMPONENT_NAME as the primary key.
   
   It is convenient for the different metric operation behind, and then there will be no common empty  data dimension in different component.
   


-- 
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] [inlong] Oneal65 commented on a diff in pull request #6195: [INLONG-6194][Agent] Support different components to parse their related metric.

Posted by GitBox <gi...@apache.org>.
Oneal65 commented on code in PR #6195:
URL: https://github.com/apache/inlong/pull/6195#discussion_r997822106


##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/AgentPrometheusMetricListener.java:
##########
@@ -142,12 +143,18 @@ public List<MetricFamilySamples> collect() {
         mfs.add(totalCounter);
 
         // id dimension
-        List<String> dimensionIdKeys = new ArrayList<>();
-        dimensionIdKeys.add(DEFAULT_DIMENSION_LABEL);
-        dimensionIdKeys.addAll(this.dimensionKeys);
-        CounterMetricFamily idCounter = new CounterMetricFamily("id", "metrics_of_agent_dimensions", dimensionIdKeys);
         for (Entry<String, MetricItemValue> entry : this.dimensionMetricValueMap.entrySet()) {
             MetricItemValue itemValue = entry.getValue();
+            Map<String, String> dimensionMap = itemValue.getDimensions();
+            String pluginId = dimensionMap.getOrDefault(KEY_PLUGIN_ID, "-");
+            String componentName = dimensionMap.getOrDefault(KEY_COMPONENT_NAME, "-");

Review Comment:
   can be abstracted into a constant



-- 
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] [inlong] dockerzhang commented on pull request #6195: [INLONG-6194][Agent] Support parsing metrics for different components

Posted by GitBox <gi...@apache.org>.
dockerzhang commented on PR #6195:
URL: https://github.com/apache/inlong/pull/6195#issuecomment-1282253435

   ` different agent components` means different collect types?


-- 
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] [inlong] Keylchen commented on pull request #6195: [INLONG-6194][Agent] Support parsing metrics for different components

Posted by GitBox <gi...@apache.org>.
Keylchen commented on PR #6195:
URL: https://github.com/apache/inlong/pull/6195#issuecomment-1283299721

   > ` different agent components` means different collect types?
   
   KEY_PLUGIN_ID or KEY_COMPONENT_NAME can identify a plugin/component.


-- 
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] [inlong] Keylchen commented on a diff in pull request #6195: [INLONG-6194][Agent] Support different components to parse their related metric.

Posted by GitBox <gi...@apache.org>.
Keylchen commented on code in PR #6195:
URL: https://github.com/apache/inlong/pull/6195#discussion_r997839181


##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/AgentPrometheusMetricListener.java:
##########
@@ -142,12 +143,18 @@ public List<MetricFamilySamples> collect() {
         mfs.add(totalCounter);
 
         // id dimension
-        List<String> dimensionIdKeys = new ArrayList<>();
-        dimensionIdKeys.add(DEFAULT_DIMENSION_LABEL);
-        dimensionIdKeys.addAll(this.dimensionKeys);
-        CounterMetricFamily idCounter = new CounterMetricFamily("id", "metrics_of_agent_dimensions", dimensionIdKeys);
         for (Entry<String, MetricItemValue> entry : this.dimensionMetricValueMap.entrySet()) {
             MetricItemValue itemValue = entry.getValue();
+            Map<String, String> dimensionMap = itemValue.getDimensions();
+            String pluginId = dimensionMap.getOrDefault(KEY_PLUGIN_ID, "-");
+            String componentName = dimensionMap.getOrDefault(KEY_COMPONENT_NAME, "-");

Review Comment:
   done.



-- 
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] [inlong] dockerzhang merged pull request #6195: [INLONG-6194][Agent] Support parsing metrics for different components

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #6195:
URL: https://github.com/apache/inlong/pull/6195


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