upgle commented on a change in pull request #4819:
URL: https://github.com/apache/openwhisk/pull/4819#discussion_r429725763
##########
File path:
common/scala/src/main/scala/org/apache/openwhisk/common/TransactionId.scala
##########
@@ -172,13 +175,22 @@ case class TransactionId private (meta:
TransactionMetadata) extends AnyVal {
def deltaToMarker(startMarker: StartMarker, endTime: Instant =
Instant.now(Clock.systemUTC)) =
Duration.between(startMarker.start, endTime).toMillis
+ def hasParent = meta.parent.isDefined
+
/**
* Formats log message to include marker.
*
* @param message: The log message without the marker
* @param marker: The marker to add to the message
*/
private def createMessageWithMarker(message: String, marker: LogMarker):
String = s"$message $marker"
+
+ /**
+ * Find root transaction metadata
+ */
+ @tailrec
+ private def findRoot(meta: TransactionMetadata): TransactionMetadata =
+ if (meta.parent.isDefined) findRoot(meta.parent.get) else meta
Review comment:
@rabbah Thank you for your sample code, I've modified the code.
----------------------------------------------------------------
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]