ZhenyuePan opened a new pull request, #12002:
URL: https://github.com/apache/inlong/pull/12002

   [INLONG-12000][Audit]Implement API for obtaining audit data in Audit Tool
   Fixes #11999 
   
   **Motivation**  
   This component provides the core functionality for periodic audit data 
inspection and alert evaluation. It enables the system to automatically check 
data consistency between source and sink components at configurable intervals, 
detect anomalies based on predefined threshold rules, and trigger alerts when 
discrepancies exceed acceptable limits.
   
   **Modifications**  
   
   1. **Periodic Check Task**  
      - Added `AuditCheckTask` class implementing scheduled background job  
      - Configurable execution interval via `executionIntervalTime` parameter  
      - Supports time-window-based audit metric querying with `startLogTs` and 
`endLogTs`  
   
   2. **Data Query Service Integration**  
      - Integrated with `AuditMetricService` for fetching audit metrics from 
storage  
      - Handles source and sink metric retrieval using 
`getStorageAuditMetrics()` method  
      - Supports multiple audit IDs through 
`auditAlertRuleManager.getAuditIds()`  
   
   3. **Alert Evaluation Integration**  
      - Incorporated `AlertEvaluator` for rule-based anomaly detection  
      - Evaluates all configured alert rules from 
`auditAlertRuleManager.getAuditAlertRuleList()`  
      - Processes comparisons between source and sink metrics for each audit ID 
 
   
   4. **Configuration Management**  
      - Added configuration parameters through `AppConfig`:  
        - `sourceAuditId`: Source audit identifier (default: "5")  
        - `executionIntervalTime`: Task execution interval in minutes (default: 
1)  
        - `intervalTimeMinute`: Time window for metric querying in minutes 
(default: 1)  
      - Implemented fallback to default values on configuration read failures  
   
   5. **Task Lifecycle Management**  
      - Added `start()` method for initiating periodic checks  
      - Implemented `stop()` method for graceful shutdown with termination 
timeout  
      - Used `ScheduledExecutorService` for robust task scheduling  
   
   **Verification**  
   - [ ] Requires unit tests for periodic task scheduling and interval 
configuration  
   - [ ] Needs integration tests for metric querying and alert evaluation flow  
   - [ ] Should validate configuration fallback behavior and error handling  
   - [ ] Must verify time window calculation correctness for different interval 
settings


-- 
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]

Reply via email to