Overview

InLong audit is a subsystem independent of InLong, which performs real-time audit and reconciliation on the incoming and outgoing traffic of the Agent, DataProxy, and Sort modules of the InLong system. There are three granularities for reconciliation: minutes, hours, and days.

The audit reconciliation is based on the log reporting time, and each service participating in the audit will conduct real-time reconciliation according to the same log time. Through audit reconciliation, we can clearly understand InLong The transmission status of each module, and whether the data stream is lost or repeated

Architecture

Overview - 图1

  1. The audit SDK is nested in the service that needs to be audited, audits the service, and sends the audit result to the audit access layer
  2. The audit proxy writes audit data to MQ (Pulsar, Kafka or TubeMQ)
  3. The distribution service consumes the audit data of MQ, and writes the audit data to MySQL or StarRocks.
  4. The interface layer encapsulates the data of MySQL or StarRocks.
  5. Application scenarios mainly include report display, audit reconciliation, etc.
  6. Support audit and reconciliation of data supplementary recording scenarios.
  7. Support audit reconciliation in Flink checkpoint scenarios.

Module

ModulesDescription
audit-sdkAudit hidden points are reported. Each module uses the SDK to report audit data
audit-proxyAudit proxy layer, receives data reported by SDK and forwards it to MQ (pulsar/kafka/tubeMQ)
audit-storeAudit storage layer, supporting common JDBC protocol
audit-serviceAudit service layer, providing aggregation, cache, OpenAPI and other capabilities

Audit Dimension

Machine ipContainer IDThread IDLog time (minutes)Audit IDinlong_group_idinlong_stream_idNumber of recordsSizeTransmission delay (ms)

Audit ID

The receiving and sending of each module are respectively an independent audit item ID

Inlong Service ModuleAudit ID
Inlong API Received Successfully1
Inlong API Send Successfully2
Inlong Agent Received Successfully3
Inlong Agent Send Successfully4
Inlong DataProxy Received Successfully5
Inlong DataProxy Send Successfully6

Data Transfer Protocol

The transmission protocol between SDK, Audit Proxy, and Audit Store is Protocol Buffers

  1. syntax = "proto3";
  2. package org.apache.inlong.audit.protocol;
  3. message BaseCommand {
  4. enum Type {
  5. PING = 0;
  6. PONG = 1;
  7. AUDITREQUEST = 2;
  8. AUDITREPLY = 3;
  9. }
  10. Type type = 1;
  11. optional AuditRequest audit_request = 2;
  12. optional AuditReply audit_reply = 3;
  13. optional Ping ping = 4;
  14. optional Pong pong = 5;
  15. }
  16. message Ping {
  17. }
  18. message Pong {
  19. }
  20. message AuditRequest {
  21. AuditMessageHeader msg_header = 1;
  22. repeated AuditMessageBody msg_body = 2;
  23. }
  24. message AuditMessageHeader {
  25. string ip = 1;
  26. string docker_id = 2;
  27. string thread_id = 3;
  28. uint64 sdk_ts = 4;
  29. uint64 packet_id = 5;
  30. }
  31. message AuditMessageBody {
  32. uint64 log_ts = 1;
  33. string inlong_group_id= 2;
  34. string inlong_stream_id= 3;
  35. string audit_id = 4;
  36. uint64 count = 5;
  37. uint64 size = 6;
  38. int64 delay = 7;
  39. }
  40. message AuditReply {
  41. enum RSP_CODE {
  42. SUCCESS = 0;
  43. FAILED = 1;
  44. DISASTER = 2;
  45. }
  46. RSP_CODE rsp_code = 1;
  47. optional string message = 2;
  48. }