ysjjovo commented on issue #4409: Log lost in method 'KubernetesRestLogSourceStage.readLines' URL: https://github.com/apache/incubator-openwhisk/issues/4409#issuecomment-482052129 Invoker upper sample 'nodejs' function,r'eadLines' method fetch logs from k8s looks like below `2019-04-11T15:47:08.617316084Z 6 2019-04-11T15:47:08.61732014Z 7 2019-04-11T15:47:08.617325379Z 8 2019-04-11T15:47:08.61732974Z 9` Some timestamp nanoseconds lost a zero in the end, therefore it's value less than last timestamp. this line will be lost. we could use code blew to verify this. `import java.time.format.DateTimeFormatterBuilder import java.time.{Instant, ZoneId} object InstantTest { def main(args:Array[String]): Unit ={ val K8STimestampFormat = new DateTimeFormatterBuilder() .parseCaseInsensitive() .appendPattern("u-MM-dd") .appendLiteral('T') .appendPattern("HH:mm:ss[.n]") .appendLiteral('Z') .toFormatter() .withZone(ZoneId.of("UTC")) val lastTimestamp=Instant.from(K8STimestampFormat.parse("2019-04-11T15:47:08.617316084Z")) val timestamp=Instant.from(K8STimestampFormat.parse("2019-04-11T15:47:08.61732014Z")) print(isRelevantLogLine(Option(lastTimestamp),timestamp)) } def isRelevantLogLine(lastTimestamp: Option[Instant], newTimestamp: Instant): Boolean = lastTimestamp match { case Some(last) => newTimestamp.isAfter(last) case None => true } }`
---------------------------------------------------------------- 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
