markusthoemmes commented on a change in pull request #3343: Support time-series 
DB using Kamon Tag, and optional granular metric.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3343#discussion_r170420043
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/common/Logging.scala
 ##########
 @@ -164,27 +164,44 @@ private object Logging {
     if (simpleName.endsWith("$")) simpleName.dropRight(1)
     else simpleName
   }
-
 }
 
 private object Emitter {
   val timeFormat = 
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneId.of("UTC"))
 }
 
-case class LogMarkerToken(component: String, action: String, state: String) {
+case class LogMarkerToken(component: String, action: String, state: String, 
tags: Option[Map[String, String]] = None) {
 
 Review comment:
   I've been looking through all the PR, and it feels a bit unclear to me to 
grasp all the branches on when something will be logged/sent and how. Maybe we 
can simplify:
   
   What do you think about creating 
   
   ```scala
   LogMarkerToken(component: String, action: String, state: String, macroTags: 
Map[String, String] = Map.empty, microTags: Map[String, String] = Map.empty)
   ```
   
   Then we could have
   
   ```scala
   override def toString = component + "_" + action + "_" + state
   override def toStringWithTags = component + "_" + action + 
macroTags.mkString(".", ".", "") + "_" + state
   ```
   
   And call them in the specific call-site accordingly:
   
   ```scala
   def emitCounterMetric(token: LogMarkerToken): Unit = {
     if (TransactionId.metricsKamon) {
       if (TransactionId.metricsKamonTags) {
         metrics.counter(token.toString, token.macroTags ++ 
token.microTags).increment(1)
       } else {
         metrics.counter(token.toStringWithTags).increment(1)
       }
     }
   }
   ```
   
   We maybe don't even need the granular option then. If the backend supports 
tags, we're fine anyway, right? We just need to make sure we only log the macro 
tags if the backend does not support "true" tags.
   
   WDYT?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to