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/01/21 10:28:19 UTC

[GitHub] [incubator-inlong] chantccc opened a new pull request #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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


   ### Title Name: [INLONG-XYZ][component] Title of the pull request
   
   where *XYZ* should be replaced by the actual issue number.
   
   Fixes #2266 
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
   
   ### 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 #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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



##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -181,6 +228,8 @@ public void removeDataFlow(DataFlowInfo dataFlowInfo) throws Exception {
                 multiTenancyDeserializer.removeDataFlow(dataFlowInfo);
                 fieldMappingTransformer.removeDataFlow(dataFlowInfo);
                 recordTransformer.removeDataFlow(dataFlowInfo);
+
+                inLongGroupIdAndStreamIdMap.remove(dataFlowInfo.getId());

Review comment:
       Remove the map between dataFlowId and inlongGroupIdStreamId immediately when the configuration data remove DataFlowInfo, maybe miss some audit data because callback is invoked lately.




-- 
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] chantccc commented on a change in pull request #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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



##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -181,6 +228,8 @@ public void removeDataFlow(DataFlowInfo dataFlowInfo) throws Exception {
                 multiTenancyDeserializer.removeDataFlow(dataFlowInfo);
                 fieldMappingTransformer.removeDataFlow(dataFlowInfo);
                 recordTransformer.removeDataFlow(dataFlowInfo);
+
+                inLongGroupIdAndStreamIdMap.remove(dataFlowInfo.getId());

Review comment:
       Once the dataflow is removed, data in memory will be discarded, audit metric is sent only after the correspond data is processed.




-- 
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] healchow merged pull request #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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


   


-- 
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 #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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



##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -122,7 +145,23 @@ public void processElement(
                     context.output(METRIC_DATA_OUTPUT_TAG, metricData);
                 }
 
-                collector.collect(recordTransformer.toSerializedRecord(sinkRecord));
+                SerializedRecord serializedSinkRecord = recordTransformer.toSerializedRecord(sinkRecord);
+
+                if (auditImp != null) {
+                    Pair<String, String> groupIdAndStreamId = inLongGroupIdAndStreamIdMap.getOrDefault(
+                            serializedRecord.getDataFlowId(),
+                            Pair.of("", ""));
+
+                    auditImp.add(
+                            Constants.METRIC_AUDIT_ID_FOR_INPUT,
+                            groupIdAndStreamId.getLeft(),
+                            groupIdAndStreamId.getRight(),
+                            sinkRecord.getTimestampMillis(),

Review comment:
       It is different between the generated time of pulsar/tube Message,the logged time of user data, current time.
   current time>the generated time of pulsar/tube Message>the logged time of user data in agent sdk.
   The log time of audit interface is for calculating delay interval in every step.




-- 
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 #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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



##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -181,6 +228,8 @@ public void removeDataFlow(DataFlowInfo dataFlowInfo) throws Exception {
                 multiTenancyDeserializer.removeDataFlow(dataFlowInfo);
                 fieldMappingTransformer.removeDataFlow(dataFlowInfo);
                 recordTransformer.removeDataFlow(dataFlowInfo);
+
+                inLongGroupIdAndStreamIdMap.remove(dataFlowInfo.getId());

Review comment:
       Then data size in hive is bigger than data size in audit metric, some data have been sent but they do not get the callback.
   But the gap can be receivable.




-- 
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 #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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



##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -122,7 +145,23 @@ public void processElement(
                     context.output(METRIC_DATA_OUTPUT_TAG, metricData);
                 }
 
-                collector.collect(recordTransformer.toSerializedRecord(sinkRecord));
+                SerializedRecord serializedSinkRecord = recordTransformer.toSerializedRecord(sinkRecord);
+
+                if (auditImp != null) {
+                    Pair<String, String> groupIdAndStreamId = inLongGroupIdAndStreamIdMap.getOrDefault(
+                            serializedRecord.getDataFlowId(),
+                            Pair.of("", ""));
+
+                    auditImp.add(
+                            Constants.METRIC_AUDIT_ID_FOR_INPUT,
+                            groupIdAndStreamId.getLeft(),
+                            groupIdAndStreamId.getRight(),
+                            sinkRecord.getTimestampMillis(),

Review comment:
       Please check that sinkRecord.getTimestampMillis() is the generated time of pulsar/tube Message or the logged time of user data or current time.
       public DeserializationResult<SerializedRecord> deserialize(@SuppressWarnings("rawtypes") Message message)
               throws IOException {
           final byte[] data = message.getData();
           return DeserializationResult.of(new SerializedRecord(dataFlowId, message.getEventTime(), data), data.length);
       }
               deserializer.flatMap(mixedRow, new CallbackCollector<>((row -> {
                   // each tid might be associated with multiple data flows
                   for (long dataFlowId : dataFlowIds) {
                       collector.collect(new Record(dataFlowId, System.currentTimeMillis(), row));
                   }
               })));

##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -181,6 +228,8 @@ public void removeDataFlow(DataFlowInfo dataFlowInfo) throws Exception {
                 multiTenancyDeserializer.removeDataFlow(dataFlowInfo);
                 fieldMappingTransformer.removeDataFlow(dataFlowInfo);
                 recordTransformer.removeDataFlow(dataFlowInfo);
+
+                inLongGroupIdAndStreamIdMap.remove(dataFlowInfo.getId());

Review comment:
       Remove the map between dataFlowId and inlongGroupIdStreamId immediately when the configuration data remove DataFlowInfo, maybe miss some audit data.

##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/hive/HiveMultiTenantWriter.java
##########
@@ -126,6 +147,20 @@ public void processElement(SerializedRecord serializedRecord, Context context,
 
             hiveWriter.processElement(recordTransformer.toRecord(serializedRecord).getRow(),
                     proxyContext.setContext(context), collector);
+
+            if (auditImp != null) {
+                Pair<String, String> groupIdAndStreamId = inLongGroupIdAndStreamIdMap.getOrDefault(
+                        serializedRecord.getDataFlowId(),
+                        Pair.of("", ""));
+
+                auditImp.add(
+                        Constants.METRIC_AUDIT_ID_FOR_OUTPUT,
+                        groupIdAndStreamId.getLeft(),
+                        groupIdAndStreamId.getRight(),
+                        serializedRecord.getTimestampMillis(),

Review comment:
       ditto




-- 
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] chantccc commented on a change in pull request #2267: [INLONG-2266][Feature]Support reporting metrics by audit-sdk in sort

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



##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/deserialization/DeserializationSchema.java
##########
@@ -122,7 +145,23 @@ public void processElement(
                     context.output(METRIC_DATA_OUTPUT_TAG, metricData);
                 }
 
-                collector.collect(recordTransformer.toSerializedRecord(sinkRecord));
+                SerializedRecord serializedSinkRecord = recordTransformer.toSerializedRecord(sinkRecord);
+
+                if (auditImp != null) {
+                    Pair<String, String> groupIdAndStreamId = inLongGroupIdAndStreamIdMap.getOrDefault(
+                            serializedRecord.getDataFlowId(),
+                            Pair.of("", ""));
+
+                    auditImp.add(
+                            Constants.METRIC_AUDIT_ID_FOR_INPUT,
+                            groupIdAndStreamId.getLeft(),
+                            groupIdAndStreamId.getRight(),
+                            sinkRecord.getTimestampMillis(),

Review comment:
       sinkRecord.getTimestampMillis() is event time extracted from pulsar/tube message

##########
File path: inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/hive/HiveMultiTenantWriter.java
##########
@@ -126,6 +147,20 @@ public void processElement(SerializedRecord serializedRecord, Context context,
 
             hiveWriter.processElement(recordTransformer.toRecord(serializedRecord).getRow(),
                     proxyContext.setContext(context), collector);
+
+            if (auditImp != null) {
+                Pair<String, String> groupIdAndStreamId = inLongGroupIdAndStreamIdMap.getOrDefault(
+                        serializedRecord.getDataFlowId(),
+                        Pair.of("", ""));
+
+                auditImp.add(
+                        Constants.METRIC_AUDIT_ID_FOR_OUTPUT,
+                        groupIdAndStreamId.getLeft(),
+                        groupIdAndStreamId.getRight(),
+                        serializedRecord.getTimestampMillis(),

Review comment:
       sinkRecord.getTimestampMillis() is event time extracted from pulsar/tube message




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