Skip to content

Commit 51af984

Browse files
authored
[INLONG-11993][Audit] The audit service supports customizing the cache on and off (#11994)
* [INLONG-11993][Audit] The audit service supports customizing the cache on and off * [INLONG-11993][Audit] Optimize the stop script for audit proxy
1 parent 0f52cae commit 51af984

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

inlong-audit/audit-service/src/main/java/org/apache/inlong/audit/service/config/ConfigConstants.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ public class ConfigConstants {
113113
public static final String KEY_ENABLE_STAT_AUDIT_DAY = "enable.stat.audit.day";
114114
public static final boolean DEFAULT_ENABLE_STAT_AUDIT_DAY = true;
115115

116+
public static final String KEY_ENABLE_STAT_AUDIT_MINUTE_10 = "enable.stat.audit.minute.10";
117+
public static final boolean DEFAULT_ENABLE_STAT_AUDIT_MINUTE_10 = true;
118+
119+
public static final String KEY_ENABLE_STAT_AUDIT_MINUTE_30 = "enable.stat.audit.minute.30";
120+
public static final boolean DEFAULT_ENABLE_STAT_AUDIT_MINUTE_30 = true;
121+
122+
public static final String KEY_ENABLE_STAT_AUDIT_HOUR = "enable.stat.audit.hour";
123+
public static final boolean DEFAULT_ENABLE_STAT_AUDIT_HOUR = true;
124+
116125
public static final String KEY_AUDIT_SERVICE_PROMETHEUS_PORT = "audit.service.prometheus.port";
117126
public static final int DEFAULT_AUDIT_SERVICE_PROMETHEUS_PORT = 10084;
118127
public static final String KEY_AUDIT_SERVICE_METRIC_CLASSNAME = "audit.service.metric.classname";

inlong-audit/audit-service/src/main/java/org/apache/inlong/audit/service/node/EtlService.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@
4242

4343
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_DATA_QUEUE_SIZE;
4444
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_ENABLE_STAT_AUDIT_DAY;
45+
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_ENABLE_STAT_AUDIT_HOUR;
46+
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_ENABLE_STAT_AUDIT_MINUTE_10;
47+
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_ENABLE_STAT_AUDIT_MINUTE_30;
4548
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_SELECTOR_SERVICE_ID;
4649
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_SUMMARY_DAILY_STAT_BACK_TIMES;
4750
import static org.apache.inlong.audit.service.config.ConfigConstants.DEFAULT_SUMMARY_REALTIME_STAT_BACK_TIMES;
4851
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_DATA_QUEUE_SIZE;
4952
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_ENABLE_STAT_AUDIT_DAY;
53+
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_ENABLE_STAT_AUDIT_HOUR;
54+
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_ENABLE_STAT_AUDIT_MINUTE_10;
55+
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_ENABLE_STAT_AUDIT_MINUTE_30;
5056
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_SELECTOR_SERVICE_ID;
5157
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_SUMMARY_DAILY_STAT_BACK_TIMES;
5258
import static org.apache.inlong.audit.service.config.ConfigConstants.KEY_SUMMARY_REALTIME_STAT_BACK_TIMES;
@@ -86,9 +92,20 @@ public void start() {
8692
int statBackTimes = configuration.get(KEY_SUMMARY_REALTIME_STAT_BACK_TIMES,
8793
DEFAULT_SUMMARY_REALTIME_STAT_BACK_TIMES);
8894

89-
startDataFlow(AuditCycle.MINUTE_10, statBackTimes, TenMinutesCache.getInstance().getCache());
90-
startDataFlow(AuditCycle.MINUTE_30, statBackTimes, HalfHourCache.getInstance().getCache());
91-
startDataFlow(AuditCycle.HOUR, statBackTimes, HourCache.getInstance().getCache());
95+
if (configuration.get(KEY_ENABLE_STAT_AUDIT_MINUTE_10, DEFAULT_ENABLE_STAT_AUDIT_MINUTE_10)) {
96+
startDataFlow(AuditCycle.MINUTE_10, statBackTimes, TenMinutesCache.getInstance().getCache());
97+
LOGGER.info("Start data flow for minute 10");
98+
}
99+
100+
if (configuration.get(KEY_ENABLE_STAT_AUDIT_MINUTE_30, DEFAULT_ENABLE_STAT_AUDIT_MINUTE_30)) {
101+
startDataFlow(AuditCycle.MINUTE_30, statBackTimes, HalfHourCache.getInstance().getCache());
102+
LOGGER.info("Start data flow for minute 30");
103+
}
104+
105+
if (configuration.get(KEY_ENABLE_STAT_AUDIT_HOUR, DEFAULT_ENABLE_STAT_AUDIT_HOUR)) {
106+
startDataFlow(AuditCycle.HOUR, statBackTimes, HourCache.getInstance().getCache());
107+
LOGGER.info("Start data flow for hour");
108+
}
92109

93110
if (configuration.get(KEY_ENABLE_STAT_AUDIT_DAY, DEFAULT_ENABLE_STAT_AUDIT_DAY)) {
94111
statBackTimes = configuration.get(KEY_SUMMARY_DAILY_STAT_BACK_TIMES, DEFAULT_SUMMARY_DAILY_STAT_BACK_TIMES);

inlong-audit/bin/proxy-stop.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@
2020
#
2121

2222
# this program kills the audit
23-
ps -ef | grep "org.apache.inlong.audit.node.Application" | grep "inlong-audit" | grep -v grep |awk '{print $2}' | xargs kill -9
23+
WAIT_TIME=30
24+
ps -ef | grep "org.apache.inlong.audit.node.Application" | grep "inlong-audit" | grep -v grep |awk '{print $2}' | xargs kill
25+
26+
echo "Stopping Audit Proxy application, please wait for $WAIT_TIME s. "
27+
28+
sleep $WAIT_TIME
29+
30+
ps -ef | grep "org.apache.inlong.audit.node.Application" | grep "inlong-audit" | grep -v grep |awk '{print $2}' | xargs kill -9

0 commit comments

Comments
 (0)