autumnust commented on a change in pull request #2835: GOBBLIN-989: Track and 
report record level SLA in Gobblin Kafka Extra…
URL: https://github.com/apache/incubator-gobblin/pull/2835#discussion_r352884161
 
 

 ##########
 File path: 
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaExtractor.java
 ##########
 @@ -176,7 +176,12 @@ public D readRecordImpl(D reuse) throws 
DataRecordException, IOException {
 
           D record = decodeKafkaMessage(nextValidMessage);
 
-          this.statsTracker.onDecodeableRecord(this.currentPartitionIdx, 
readStartTime, decodeStartTime, nextValidMessage.getValueSizeInBytes());
+          long logAppendTime = 0L;
+          if (nextValidMessage.isTimestampLogAppend()) {
+            logAppendTime = nextValidMessage.getTimestamp();
+          }
+          this.statsTracker.onDecodeableRecord(this.currentPartitionIdx, 
readStartTime, decodeStartTime,
 
 Review comment:
   I personally found ternary operator in this case: 
`this.statsTracker.onDecodeableRecord(this.currentPartitionIdx, readStartTime, 
decodeStartTime,  condition ? 0L : nextValidMessage.getTimestamp()). ` more 
readable. 
   
   googled a little bit, maybe this is a simple-enough case?  
https://stackoverflow.com/questions/160218/to-ternary-or-not-to-ternary.  Don't 
have strong opinion on this though
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to