public KafkaAuditReporter(String topicForAuditMsg, String auditDC, String auditTier, String brokerList, String requiredAcks, MetricRegistry metricRegistry) throws IOException { this.topicForAuditMsg = topicForAuditMsg; this.hostMetadata = new HostMetadata(auditDC, auditTier); this.producer = getKafkaProducer(brokerList, requiredAcks, hostMetadata); if (metricRegistry == null) { logger.info("Using temporary metrics registry"); metricRegistry = new MetricRegistry(); } this.messageReportRate = metricRegistry.meter("kafkaAuditReporter.messageReportRate"); this.bucketReportRate = metricRegistry.meter("kafkaAuditReporter.bucketReportRate"); }