Source:
private void performSlaRelatedLogging(DatastreamRecordMetadata metadata, long eventsSourceTimestamp, long sourceToDestinationLatencyMs) { if (_warnLogLatencyEnabled && (sourceToDestinationLatencyMs > _warnLogLatencyThresholdMs)) { _logger.warn("Source to destination latency ms is higher than ms, Datastream: {}, Source Timestamp: {}, " + "Metadata: {}", sourceToDestinationLatencyMs, _warnLogLatencyThresholdMs, getDatastreamName(), eventsSourceTimestamp, metadata); } if (_numEventsOutsideAltSlaLogEnabled) { try { if (sourceToDestinationLatencyMs > _availabilityThresholdAlternateSlaMs) { TopicPartition topicPartition = new TopicPartition(metadata.getTopic(), metadata.getSourcePartition()); int numEvents = _trackEventsOutsideAltSlaMap.getOrDefault(topicPartition, 0); _trackEventsOutsideAltSlaMap.put(topicPartition, numEvents + 1); } long timeSinceLastLog = System.currentTimeMillis() - _lastEventsOutsideAltSlaLogTimeMs; if (timeSinceLastLog >= _numEventsOutsideAltSlaFrequencyMs) { _trackEventsOutsideAltSlaMap.forEach((topicPartition, numEvents) -> _logger.warn( "{} had event(s) with latency greater than alternate SLA of ms in the last ms for " + "datastream {}", topicPartition, numEvents, _availabilityThresholdAlternateSlaMs, timeSinceLastLog, getDatastreamName())); _trackEventsOutsideAltSlaMap.clear(); _lastEventsOutsideAltSlaLogTimeMs = System.currentTimeMillis(); } } catch (ConcurrentModificationException | NullPointerException | IllegalArgumentException | ClassCastException | UnsupportedOperationException e) { _logger.warn("Could not perform warn logging due to exception: ", e); } } }

Target:
private void performSlaRelatedLogging(DatastreamRecordMetadata metadata, long eventsSourceTimestamp, long sourceToDestinationLatencyMs) { if (_warnLogLatencyEnabled && (sourceToDestinationLatencyMs > _warnLogLatencyThresholdMs)) { _logger.warn("Source to destination latency ms is higher than ms, Datastream: {}, Source Timestamp: {}, " + "Metadata: {}", sourceToDestinationLatencyMs, _warnLogLatencyThresholdMs, getDatastreamName(), eventsSourceTimestamp, metadata); } if (_numEventsOutsideAltSlaLogEnabled) { try { if (sourceToDestinationLatencyMs > _availabilityThresholdAlternateSlaMs) { TopicPartition topicPartition = new TopicPartition(metadata.getTopic(), metadata.getSourcePartition()); int numEvents = _trackEventsOutsideAltSlaMap.getOrDefault(topicPartition, 0); _trackEventsOutsideAltSlaMap.put(topicPartition, numEvents + 1); } long timeSinceLastLog = System.currentTimeMillis() - _lastEventsOutsideAltSlaLogTimeMs; if (timeSinceLastLog >= _numEventsOutsideAltSlaFrequencyMs) { _trackEventsOutsideAltSlaMap.forEach((topicPartition, numEvents) -> _logger.warn( "{} had event(s) with latency greater than alternate SLA of ms in the last ms for " + "datastream {}", topicPartition, numEvents, _availabilityThresholdAlternateSlaMs, timeSinceLastLog, getDatastreamName())); _trackEventsOutsideAltSlaMap.clear(); _lastEventsOutsideAltSlaLogTimeMs = System.currentTimeMillis(); } } catch (NullPointerException | IllegalArgumentException | ClassCastException | UnsupportedOperationException e) { _logger.warn("Could not perform warn logging due to exception: ", e); } } }