This is an automated email from the ASF dual-hosted git repository.
doleyzi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 7a1c89769c [INLONG-11404][Audit] Optimize the Audit item in dashboard
display (#11405)
7a1c89769c is described below
commit 7a1c89769c5fcce9f7380d95b5c39c1e10829431
Author: doleyzi <[email protected]>
AuthorDate: Thu Oct 24 18:53:43 2024 +0800
[INLONG-11404][Audit] Optimize the Audit item in dashboard display (#11405)
---
.../inlong/audit/util/AuditManagerUtils.java | 57 ++++++++++++++++++++--
1 file changed, 53 insertions(+), 4 deletions(-)
diff --git
a/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/util/AuditManagerUtils.java
b/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/util/AuditManagerUtils.java
index e8802b593d..f470251b0e 100644
---
a/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/util/AuditManagerUtils.java
+++
b/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/util/AuditManagerUtils.java
@@ -28,6 +28,8 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList;
import java.util.List;
+import static org.apache.inlong.audit.AuditIdEnum.*;
+
/**
* Audit item ID generation rules: composed of basic audit item ID + extension
bits.
* Each module is assigned two basic audit item IDs, namely reception and
transmission.
@@ -169,22 +171,69 @@ public class AuditManagerUtils {
private static List<AuditInformation> combineAuditInformation(String
auditType, FlowType flowType) {
List<AuditInformation> auditInformationList = new LinkedList<>();
boolean[] combinations = {true, false};
+
for (boolean success : combinations) {
for (boolean isRealtime : combinations) {
for (boolean discard : combinations) {
for (boolean retry : combinations) {
- if (discard && retry) {
- continue;
+ if (shouldIncludeCombination(auditType, flowType,
success, isRealtime, discard, retry)) {
+ auditInformationList.add(
+ buildAuditInformation(auditType, flowType,
success, isRealtime, discard, retry));
}
- auditInformationList
- .add(buildAuditInformation(auditType,
flowType, success, isRealtime, discard, retry));
}
}
}
}
+
return auditInformationList;
}
+ /**
+ * Exclude some uncommon audit scenarios
+ * @param auditType
+ * @param flowType
+ * @param success
+ * @param isRealtime
+ * @param discard
+ * @param retry
+ * @return
+ */
+ private static boolean shouldIncludeCombination(String auditType, FlowType
flowType, boolean success,
+ boolean isRealtime, boolean discard, boolean retry) {
+ // Exclude the situation when retry and discard occur at the same time
+ if (discard && retry) {
+ return false;
+ }
+
+ AuditIdEnum baseAuditId = AuditIdEnum.getAuditId(auditType, flowType);
+ // Exclude the situation when non-real-time and one of
SDK、Agent、DataProxy occur at the same time
+ if (!isRealtime && isExcludedWhenNotRealtime(baseAuditId)) {
+ return false;
+ }
+
+ // Exclude the situation when failed、input and one of discard and
retry occur at the same time
+ if (!success && flowType == FlowType.INPUT && (discard || retry)) {
+ return false;
+ }
+
+ // Exclude the situation when failed、output and discard occur at the
same time
+ if (!success && flowType == FlowType.OUTPUT && discard) {
+ return false;
+ }
+
+ // Exclude the situation when success、input and retry occur at the
same time
+ if (success && flowType == FlowType.INPUT && retry) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private static boolean isExcludedWhenNotRealtime(AuditIdEnum baseAuditId) {
+ return baseAuditId == SDK_INPUT || baseAuditId == SDK_OUTPUT ||
baseAuditId == AGENT_INPUT
+ || baseAuditId == AGENT_OUTPUT || baseAuditId ==
DATA_PROXY_INPUT || baseAuditId == DATA_PROXY_OUTPUT;
+ }
+
/**
* Get max Audit ID.
*