Source:
<code>public void run() { _logger.info("Starting the Kafka-based connector task for {}", _datastreamTask); _connectorTaskThread = Thread.currentThread(); boolean startingUp = true; long pollInterval = 0; _eventsProcessedCountLoggedTime = Instant.now(); try { _consumer = createKafkaConsumer(_consumerProps); consumerSubscribe(); ConsumerRecords<?, ?> records; while (!_shutdown) { preConsumerPollHook(); records = pollRecords(pollInterval); if (startingUp) { pollInterval = _pollTimeoutMillis; startingUp = false; _startedLatch.countDown(); } int recordsPolled = 0; if (records != null && !records.isEmpty()) { _kafkaTopicPartitionTracker.onPartitionsPolled(records); Instant readTime = Instant.now(); long readTimeInNanos = System.nanoTime(); <START> processRecords(records, readTime, readTimeInNanos); <END> recordsPolled = records.count(); } maybeCommitOffsets(_consumer, false); trackEventsProcessedProgress(recordsPolled); } _logger.info("Flushing and committing offsets before task exits.", _taskName); maybeCommitOffsets(_consumer, true); } catch (WakeupException e) { if (_shutdown) { _logger.info("Got WakeupException, shutting down task {}.", _taskName); maybeCommitOffsets(_consumer, true); } else { _logger.error("Got WakeupException while not in shutdown mode.", e); throw e; } } catch (Exception e) { _logger.error(String.format("%s failed with exception.", _taskName), e); _datastreamTask.setStatus(DatastreamTaskStatus.error(e.toString() + ExceptionUtils.getFullStackTrace(e))); throw new DatastreamRuntimeException(e); } finally { if (null != _consumer) { try { _consumer.close(); } catch (Exception e) { _logger.warn(String.format("Got exception on consumer close for task %s.", _taskName), e); } } postShutdownHook(); _stoppedLatch.countDown(); _logger.info("{} stopped", _taskName); } }</code><technical_language>Nitpick. pass System.nanoTime() processRecords I dont logging this variable in other way</technical_language>

Target:
public void run() { _logger.info("Starting the Kafka-based connector task for {}", _datastreamTask); _connectorTaskThread = Thread.currentThread(); boolean startingUp = true; long pollInterval = 0; _eventsProcessedCountLoggedTime = Instant.now(); try { _consumer = createKafkaConsumer(_consumerProps); consumerSubscribe(); ConsumerRecords<?, ?> records; while (!_shutdown) { preConsumerPollHook(); records = pollRecords(pollInterval); if (startingUp) { pollInterval = _pollTimeoutMillis; startingUp = false; _startedLatch.countDown(); } int recordsPolled = 0; if (records != null && !records.isEmpty()) { _kafkaTopicPartitionTracker.onPartitionsPolled(records); Instant readTime = Instant.now(); processRecords(records, readTime, System.nanoTime()); recordsPolled = records.count(); } maybeCommitOffsets(_consumer, false); trackEventsProcessedProgress(recordsPolled); } _logger.info("Flushing and committing offsets before task exits.", _taskName); maybeCommitOffsets(_consumer, true); } catch (WakeupException e) { if (_shutdown) { _logger.info("Got WakeupException, shutting down task {}.", _taskName); maybeCommitOffsets(_consumer, true); } else { _logger.error("Got WakeupException while not in shutdown mode.", e); throw e; } } catch (Exception e) { _logger.error(String.format("%s failed with exception.", _taskName), e); _datastreamTask.setStatus(DatastreamTaskStatus.error(e.toString() + ExceptionUtils.getFullStackTrace(e))); throw new DatastreamRuntimeException(e); } finally { if (null != _consumer) { try { _consumer.close(); } catch (Exception e) { _logger.warn(String.format("Got exception on consumer close for task %s.", _taskName), e); } } postShutdownHook(); _stoppedLatch.countDown(); _logger.info("{} stopped", _taskName); } }