cbickel commented on a change in pull request #3199: One tid for the whole system. URL: https://github.com/apache/incubator-openwhisk/pull/3199#discussion_r179360697
########## File path: common/scala/src/main/scala/whisk/common/TransactionId.scala ########## @@ -200,39 +204,37 @@ object TransactionId { val metricsKamonTags: Boolean = sys.env.get("METRICS_KAMON_TAGS").getOrElse("False").toBoolean val metricsLog: Boolean = sys.env.get("METRICS_LOG").getOrElse("True").toBoolean - val unknown = TransactionId(0) - val testing = TransactionId(-1) // Common id for for unit testing - val invoker = TransactionId(-100) // Invoker startup/shutdown or GC activity - val invokerWarmup = TransactionId(-101) // Invoker warmup thread that makes stem-cell containers - val invokerNanny = TransactionId(-102) // Invoker nanny thread - val dispatcher = TransactionId(-110) // Kafka message dispatcher - val loadbalancer = TransactionId(-120) // Loadbalancer thread - val invokerHealth = TransactionId(-121) // Invoker supervision - val controller = TransactionId(-130) // Controller startup - val dbBatcher = TransactionId(-140) // Database batcher - - def apply(tid: BigDecimal, extraLogging: Boolean = false): TransactionId = { + val unknown = TransactionId(0.toString, isSid = true) + val testing = TransactionId((1).toString, isSid = true) // Common id for for unit testing + val invoker = TransactionId((100).toString, isSid = true) // Invoker startup/shutdown or GC activity + val invokerWarmup = TransactionId((101).toString, isSid = true) // Invoker warmup thread that makes stem-cell containers + val invokerNanny = TransactionId((102).toString, isSid = true) // Invoker nanny thread + val dispatcher = TransactionId((110).toString, isSid = true) // Kafka message dispatcher + val loadbalancer = TransactionId((120).toString, isSid = true) // Loadbalancer thread + val invokerHealth = TransactionId((121).toString, isSid = true) // Invoker supervision + val controller = TransactionId((130).toString, isSid = true) // Controller startup + val dbBatcher = TransactionId((140).toString, isSid = true) // Database batcher + + def apply(tid: String, extraLogging: Boolean = false, isSid: Boolean = false): TransactionId = { Try { val now = Instant.now(Clock.systemUTC()) - TransactionId(TransactionMetadata(tid.toLong, now, extraLogging)) + TransactionId(TransactionMetadata(tid, now, extraLogging, isSid)) } getOrElse unknown } implicit val serdes = new RootJsonFormat[TransactionId] { - def write(t: TransactionId) = { - if (t.meta.extraLogging) - JsArray(JsNumber(t.meta.id), JsNumber(t.meta.start.toEpochMilli), JsBoolean(t.meta.extraLogging)) - else - JsArray(JsNumber(t.meta.id), JsNumber(t.meta.start.toEpochMilli)) - } + def write(t: TransactionId) = + JsArray( + JsString(t.meta.id), + JsNumber(t.meta.start.toEpochMilli), + JsBoolean(t.meta.extraLogging), + JsBoolean(t.meta.isSid)) Review comment: Isn't this also used to put the TransactionId into the activationMessage that is sent from the controller to the invoker? And the loadbalancer is invoking some health actions with a sid as TransactionId. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services