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/12 10:59:23 UTC

[GitHub] [inlong] GanfengTan commented on a diff in pull request #5534: [INLONG-5533][Agent] Support structured output in the Kubernetes

GanfengTan commented on code in PR #5534:
URL: https://github.com/apache/inlong/pull/5534#discussion_r944354038


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/AbstractFileReader.java:
##########
@@ -35,9 +44,26 @@ public void mergeData(FileReaderOperator fileReaderOperator) {
         if (null == fileReaderOperator.metadata) {
             return;
         }
-
         List<String> lines = fileReaderOperator.stream.collect(Collectors.toList());
-        lines.forEach(data -> data = MetaDataUtils.concatString(data, fileReaderOperator.metadata));
+        if (fileReaderOperator.jobConf.hasKey(JOB_FILE_CONTENT_COLLECT_TYPE)) {
+            long timestamp = System.currentTimeMillis();
+            Gson gson = new Gson();

Review Comment:
   done



##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/KubernetesFileReader.java:
##########
@@ -60,22 +71,30 @@ public void getData() {
         if (Objects.nonNull(client) && Objects.nonNull(fileReaderOperator.metadata)) {
             return;
         }
-        client = getKubernetesClient();
-        Map<String, String> k8sInfo = MetaDataUtils.getLogInfo(fileReaderOperator.file.getName());
-        ObjectMeta objectMeta = getPodMetadata(k8sInfo.get(NAMESPACE), k8sInfo.get(POD_NAME));
-        fileReaderOperator.metadata = Objects.nonNull(objectMeta) ? objectMeta.toString() : null;
+        try {
+            client = getKubernetesClient();
+        } catch (IOException e) {
+            log.error("Get k8s client error: {}", e.getMessage());

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