dockerzhang commented on code in PR #10232:
URL: https://github.com/apache/inlong/pull/10232#discussion_r1603082249
##########
inlong-audit/audit-sdk/README.md:
##########
@@ -11,7 +11,7 @@ The Audit Sdk uses log production time as the audit standard,
which can ensure that each module is reconciled in accordance with the unified
audit standard.
## Usage
-### setAuditProxy API
+### SetAuditProxy API
Review Comment:
```suggestion
### Configure Audit Proxy Addresses
```
##########
inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/AuditReporterImpl.java:
##########
@@ -56,8 +57,10 @@ public class AuditReporterImpl implements Serializable {
private static final String FIELD_SEPARATORS = ":";
private static final long DEFAULT_AUDIT_VERSION = -1;
private static final int BATCH_NUM = 100;
- private final ReentrantLock GLOBAL_LOCK = new ReentrantLock();
private static final int PERIOD = 1000 * 60;
+ // Resource isolation key is used in checkpoint and other
scenarios.DEFAULT 0.
Review Comment:
Resource isolation key is used in checkpoint, the default value is 0
##########
inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/util/AuditManagerUtils.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.audit.util;
+
+import 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.
+ * Based on reception and transmission, and expanded through extension bits,
+ * audit item IDs such as success and failure, real-time and non-real-time,
retry and discard can be generated.
+ */
+public class AuditManagerUtils {
+
+ public static final int AUDIT_SUFFIX_LENGTH = 16;
+ public static final int AUDIT_MAX_PREFIX_LENGTH = 14;
+
+ private static String buildSuccessAndFailureFlag(boolean success) {
+ return success ? "0" : "1";
+ }
+
+ private static String buildRealtimeFlag(boolean isRealtime) {
+ return isRealtime ? "0" : "1";
+ }
+
+ private static String buildDiscardFlag(boolean discard) {
+ return discard ? "1" : "0";
+ }
+
+ private static String buildRetryFlag(boolean retry) {
+ return retry ? "1" : "0";
+ }
+
+ private static String buildAuditIdSuffix(int auditId) {
+ StringBuilder auditIdBinaryString = new
StringBuilder(Integer.toBinaryString(auditId));
+ for (int i = auditIdBinaryString.length(); i < AUDIT_SUFFIX_LENGTH;
i++) {
+ auditIdBinaryString.insert(0, "0");
+ }
+ return auditIdBinaryString.toString();
+ }
+
+ /**
+ * Generate success and failure, real-time and non-real-time, retry,
discard and other Audit item IDs through the baseline Audit ID.
Review Comment:
```suggestion
* Generate Audit item IDs.
```
##########
inlong-audit/audit-sdk/README.md:
##########
@@ -11,7 +11,7 @@ The Audit Sdk uses log production time as the audit standard,
which can ensure that each module is reconciled in accordance with the unified
audit standard.
## Usage
-### setAuditProxy API
+### SetAuditProxy API
Set the AuditProxy ip:port list. The Audit Sdk will summarize the results
according to the cycle
Review Comment:
```suggestion
The Audit SDK will summarize the results according to the cycle
```
##########
inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/AuditReporterImpl.java:
##########
@@ -502,4 +501,22 @@ private void checkFlushTime() {
}
});
}
+
+ /**
+ * Generate success and failure, real-time and non-real-time, retry,
discard and other Audit item IDs through the baseline Audit ID.
Review Comment:
```suggestion
* Generate Audit item IDs.
```
##########
inlong-audit/audit-sdk/README.md:
##########
@@ -68,4 +76,20 @@ In order to ensure the accuracy of auditing, each operator
needs to create an au
|----------|----------|
| count | count |
| size | size |
-| delayTime | Data transmission delay,equal to current time minus log time
|
\ No newline at end of file
+| delayTime | Data transmission delay,equal to current time minus log time
|
+
+#### Build Audit item ID
+```java
+ AuditManagerUtils.buildAuditId(AuditIdEnum baseAuditId,
+ boolean success,
+ boolean isRealtime,
+ boolean discard,
+ boolean retry);
+```
+| parameter | meaning
|
Review Comment:
```suggestion
| parameter | description
|
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]