Singer 0.8.0-rc.2
Pre-releaselogging-audit client implementation part 2:
(1) add LoggingAuditClient and its configuration parsing code. LoggingAuditClient maintains LinkedBlockingDeque of LoggingAuditEvent, has a AuditEventSender (wrapper of KafkaProducer) and provides audit() method for various clients. audit() method is called by client such as ThriftLogger instance and Singer's KafkaWriter in order to generate and enqueue a LoggingAuditEvent. LoggingAuditEvent is corresponding to LoggingAuditHeaders injected into the LogMessage.
(2) add implementations to singer module in order to enable LoggingAudit feature which is configurable per logStream (SingerLogConfig). SingerSettings will maintain an instance of LoggingAuditClient for handling LoggingAuditEvent generation and emission. Singer cleanup thread will call the close method of LoggingAuditClient to gracefully shutdown and cleanup LoggingAuditEvents left in the LinkedBlockingDeque.
(3) add implementations to thrift-logger module in order to enable LoggingAudit feature which is configurable per topic. AuditableLogbackThriftLoggerFactory will maintain an instance LoggingAuditClient for handling LoggingAuditEvent generation and emission. The close method of LoggingAuditClient is added at the end of shutdown method of AuditableLogbackThriftLoggerFactory.
(4) refactor ThriftLoggerFactory, AuditableLogbackThriftLoggerFactory and AuditableLogbackThriftLogger to make sure: AuditableLogbackThriftLoggerFactory is called by default in ThriftLoggerFactory. Whether LoggingAudit feature is enabled or not for AuditableLogbackThriftLoggerFactory depends on LoggingAuditClient being created properly; whether LoggingAudit feature is enabled or not for certain topic depends on ThriftLoggerConfig being created properly when creating AuditableLogbackThriftLogger instance. If LoggingAudit required fields are not set in ThriftLoggerConfig, the created AuditableLogbackThriftLogger instance behaves the same as the normal LogbackThriftLogger instance.