diff --git a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java index b4f74bfc63..76e4b8f31e 100644 --- a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java +++ b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/metrics/audit/AuditUtils.java @@ -22,6 +22,9 @@ import org.apache.inlong.audit.AuditOperator; import org.apache.inlong.audit.entity.AuditComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.HashSet; import static org.apache.inlong.agent.constant.AgentConstants.AUDIT_ENABLE; @@ -38,6 +41,8 @@ */ public class AuditUtils { + private static final Logger LOGGER = LoggerFactory.getLogger(AuditUtils.class); + public static final int AGENT_ISOLATE_KEY = 1; public static int AUDIT_ID_AGENT_READ_SUCCESS = 3; public static int AUDIT_ID_AGENT_SEND_SUCCESS = 4; public static int AUDIT_ID_AGENT_READ_FAILED = 524291; @@ -90,8 +95,17 @@ public static void add(int auditID, String inlongGroupId, String inlongStreamId, if (!IS_AUDIT) { return; } - AuditOperator.getInstance() - .add(auditID, DEFAULT_AUDIT_TAG, inlongGroupId, inlongStreamId, logTime, count, size, version); + if (inlongGroupId == null || inlongStreamId == null) { + LOGGER.error("invalid args inlongGroupId: {}, inlongStreamId: {}", inlongGroupId, inlongStreamId); + return; + } + try { + AuditOperator.getInstance() + .add(auditID, DEFAULT_AUDIT_TAG, inlongGroupId, inlongStreamId, logTime, count, size, version); + } catch (Throwable e) { + LOGGER.error("call audit add inlongGroupId: {}, inlongStreamId: {}, auditID {}, error", inlongGroupId, + inlongStreamId, auditID, e); + } } public static void add(int auditID, String inlongGroupId, String inlongStreamId, @@ -106,6 +120,6 @@ public static void send() { if (!IS_AUDIT) { return; } - AuditOperator.getInstance().flush(); + AuditOperator.getInstance().flush(AGENT_ISOLATE_KEY); } } diff --git a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/TaskType.java b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/TaskType.java deleted file mode 100644 index 65203d0522..0000000000 --- a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/TaskType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.inlong.agent.plugin.task.file; - -public enum TaskType { - - READER(0), - TAILER(1), - UPLOADER(2), - STATE(3), - OTHER(4), - DB(5), - GAIAReader(6); - - private int type; - - TaskType(int type) { - this.type = type; - } - - public int getType() { - return type; - } -} \ No newline at end of file