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/08/01 11:19:42 UTC

[GitHub] [inlong] yunqingmoswu opened a new pull request, #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   Title: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
   
   Fixes #5312 
   
   ### Motivation
   
   At present, many connectors support indicator reporting, but we have not added relevant metric reporting parameters at the entrance. And so, I add unified `inlong.metric` parameter injection support for nodes.
   
   ### Modifications
   
   The metric parameter `inlong.metric` will be added to the node options auto if it has implemented the interface InLongMetric.
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [x] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] 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 follow-up 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] [inlong] EMsnap commented on a diff in pull request #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/PostgresExtractNode.java:
##########
@@ -100,7 +101,7 @@ public PostgresExtractNode(@JsonProperty("id") String id,
      *
      * @return options
      * @see <a href="https://ververica.github.io/flink-cdc-connectors/master/content/connectors/postgres-cdc.html">postgres
-     * cdc</a>
+     *         cdc</a>

Review Comment:
   extra blank



-- 
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] yunqingmoswu commented on pull request #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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

   > PostgresExtractNode and HBaseLoadNode modify connector option
   
   It is better to mention PR separately later.


-- 
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] gong commented on a diff in pull request #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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


##########
inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/parser/impl/FlinkSqlParser.java:
##########
@@ -159,6 +162,23 @@ private void parseStream(StreamInfo streamInfo) {
         log.info("parse stream success, streamId:{}", streamInfo.getStreamId());
     }
 
+    /**
+     * Inject the `inlong.metric` for ExtractNode or LoadNode
+     *
+     * @param streamInfo The encapsulation of nodes and node relations
+     */
+    private void injectInLongMetric(StreamInfo streamInfo) {
+        streamInfo.getNodes().stream().filter(node -> node instanceof InLongMetric).forEach(node -> {
+            Map<String, String> properties = node.getProperties();
+            if (properties == null) {
+                properties = new LinkedHashMap<>();
+            }

Review Comment:
   if properties is null, new LinkedHashMap should be writed back to node by node.setProperties



-- 
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] gong commented on pull request #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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

   PostgresExtractNode and HBaseLoadNode modify connector option


-- 
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 #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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


-- 
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] yunqingmoswu commented on a diff in pull request #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/PostgresExtractNode.java:
##########
@@ -100,7 +101,7 @@ public PostgresExtractNode(@JsonProperty("id") String id,
      *
      * @return options
      * @see <a href="https://ververica.github.io/flink-cdc-connectors/master/content/connectors/postgres-cdc.html">postgres
-     * cdc</a>
+     *         cdc</a>

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] yunqingmoswu commented on a diff in pull request #5318: [INLONG-5312][Sort] Add unified inlong.metric parameter injection support for nodes

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


##########
inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/parser/impl/FlinkSqlParser.java:
##########
@@ -159,6 +162,23 @@ private void parseStream(StreamInfo streamInfo) {
         log.info("parse stream success, streamId:{}", streamInfo.getStreamId());
     }
 
+    /**
+     * Inject the `inlong.metric` for ExtractNode or LoadNode
+     *
+     * @param streamInfo The encapsulation of nodes and node relations
+     */
+    private void injectInLongMetric(StreamInfo streamInfo) {
+        streamInfo.getNodes().stream().filter(node -> node instanceof InLongMetric).forEach(node -> {
+            Map<String, String> properties = node.getProperties();
+            if (properties == null) {
+                properties = new LinkedHashMap<>();
+            }

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