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

   [INLONG-11923][Audit] Add the function of fetching Audit Data and Alert 
Policies from Manager
   
   Fixes https://github.com/apache/inlong/issues/11923
   
   Motivation
   Apache InLong currently lacks the ability to obtain audit policies and audit 
data from the Manager service. Without these inputs, the system cannot compare 
actual audit data against configured policies to generate alerts. This change 
introduces a scheduled mechanism to pull audit policies and audit data from the 
Manager service and forward normalized payloads to downstream services for 
comparison and aggregation.
   
   Modifications
   
   Data Model Layer
   Added AuditAlertRule.java to receive audit policy definitions fetched from 
Manager.
   Added AuditData.java and AuditInfo.java to model audit data returned by 
Manager.
   Added AuditVO.java to transfer normalized audit data to downstream services.
   Added AuditRequest.java as the request payload for Manager API calls.
   Added Response.java to wrap all request results with status and payload.
   Added HttpUtils.java as a lightweight HTTP helper for request/response 
handling.
   Added CommonBeanUtils.java to convert and map between related bean objects.
   Core Service Layer
   Implemented ManagerClient.java to interact with the Manager service for 
fetching audit policies and audit data.
   Updated AuditCheckTask.java to periodically fetch data via a scheduler and 
added a retry mechanism for transient failures.
   App Config
   Enabled automatic configuration loading (e.g., Manager service base URL, 
timeouts, schedule interval, retry/backoff parameters).
   Logging
   Emitted structured logs at task start, success, and failure to facilitate 
end-to-end observability and troubleshooting.
   AuditTool Main
   Started a dedicated thread to orchestrate the end-to-end workflow (policy 
fetch → data fetch → transform → forward to downstream).
   Verifying this change
   This change added tests and can be verified as follows:
   
   Unit Tests:
   Added comprehensive tests for ManagerClient request/response parsing.
   Validated bean conversion in CommonBeanUtils and HTTP error handling in 
HttpUtils.
   Test Coverage:
   Data model serialization/deserialization.
   Configuration loading and fallback defaults.
   Logging paths for success and failure scenarios.
   Note
   The core fetching and orchestration logic, along with related test cases, 
were independently designed and implemented by me. Additional integrations and 
refinements were completed in collaboration with the team.


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