[GitHub] [openwhisk] sven-lange-last commented on a change in pull request #4609: Add namespace field to activation log

2019-09-23 Thread GitBox
sven-lange-last commented on a change in pull request #4609: Add namespace 
field to activation log
URL: https://github.com/apache/openwhisk/pull/4609#discussion_r327054113
 
 

 ##
 File path: 
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationFileStorage.scala
 ##
 @@ -84,9 +84,11 @@ class ActivationFileStorage(logFilePrefix: String,
 
   private def transcribeLogs(activation: WhiskActivation, additionalFields: 
Map[String, JsValue]) =
 activation.logs.logs.map { log =>
-  val line = JsObject(
-Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
-  "activationId" -> activation.activationId.toJson) ++ 
additionalFields)
+  val line =
+JsObject(
+  Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
+"activationId" -> activation.activationId.toJson) ++ Map(
+"namespace" -> activation.namespace.asString.toJson) ++ 
additionalFields)
 
 Review comment:
   We clarified the open questions in a personal Slack communication and agreed 
on a solution.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [openwhisk] sven-lange-last commented on a change in pull request #4609: Add namespace field to activation log

2019-09-23 Thread GitBox
sven-lange-last commented on a change in pull request #4609: Add namespace 
field to activation log
URL: https://github.com/apache/openwhisk/pull/4609#discussion_r326956331
 
 

 ##
 File path: 
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationFileStorage.scala
 ##
 @@ -84,9 +84,11 @@ class ActivationFileStorage(logFilePrefix: String,
 
   private def transcribeLogs(activation: WhiskActivation, additionalFields: 
Map[String, JsValue]) =
 activation.logs.logs.map { log =>
-  val line = JsObject(
-Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
-  "activationId" -> activation.activationId.toJson) ++ 
additionalFields)
+  val line =
+JsObject(
+  Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
+"activationId" -> activation.activationId.toJson) ++ Map(
+"namespace" -> activation.namespace.asString.toJson) ++ 
additionalFields)
 
 Review comment:
   Let's have a look at the code:
   
   
https://github.com/apache/openwhisk/blob/400a7915115576a363858788a6d080c389a80317/common/scala/src/main/scala/org/apache/openwhisk/core/database/ArtifactWithFileStorageActivationStore.scala#L55-L62
   
   If you add the `namespace` field to the `additionalFields` map in line 58, 
it will be persisted to logs via `activationFileStorage.activationToFile()` in 
line 60.
   
   The `additionalFields` map won't be considered when storing the activation 
to the database (line 61).
   
   Do you come to the same conclusion?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [openwhisk] sven-lange-last commented on a change in pull request #4609: Add namespace field to activation log

2019-09-20 Thread GitBox
sven-lange-last commented on a change in pull request #4609: Add namespace 
field to activation log
URL: https://github.com/apache/openwhisk/pull/4609#discussion_r326536398
 
 

 ##
 File path: 
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationFileStorage.scala
 ##
 @@ -84,9 +84,11 @@ class ActivationFileStorage(logFilePrefix: String,
 
   private def transcribeLogs(activation: WhiskActivation, additionalFields: 
Map[String, JsValue]) =
 activation.logs.logs.map { log =>
-  val line = JsObject(
-Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
-  "activationId" -> activation.activationId.toJson) ++ 
additionalFields)
+  val line =
+JsObject(
+  Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
+"activationId" -> activation.activationId.toJson) ++ Map(
+"namespace" -> activation.namespace.asString.toJson) ++ 
additionalFields)
 
 Review comment:
   I guess you also need to update this line in the test to inject the 
`namespace` field:
   
   
https://github.com/apache/openwhisk/blob/37ae815892ae03908c4804c4f826760224f09eea/tests/src/test/scala/org/apache/openwhisk/core/database/ArtifactWithFileStorageActivationStoreTests.scala#L280


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [openwhisk] sven-lange-last commented on a change in pull request #4609: Add namespace field to activation log

2019-09-20 Thread GitBox
sven-lange-last commented on a change in pull request #4609: Add namespace 
field to activation log
URL: https://github.com/apache/openwhisk/pull/4609#discussion_r326534807
 
 

 ##
 File path: 
common/scala/src/main/scala/org/apache/openwhisk/core/database/ActivationFileStorage.scala
 ##
 @@ -84,9 +84,11 @@ class ActivationFileStorage(logFilePrefix: String,
 
   private def transcribeLogs(activation: WhiskActivation, additionalFields: 
Map[String, JsValue]) =
 activation.logs.logs.map { log =>
-  val line = JsObject(
-Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
-  "activationId" -> activation.activationId.toJson) ++ 
additionalFields)
+  val line =
+JsObject(
+  Map("type" -> "user_log".toJson) ++ Map("message" -> log.toJson) ++ 
Map(
+"activationId" -> activation.activationId.toJson) ++ Map(
+"namespace" -> activation.namespace.asString.toJson) ++ 
additionalFields)
 
 Review comment:
   Thanks for attending to my feedback and also covering other log stores.
   
   At the same time: can you please move the `namespace` extension over to 
`ArtifactWithFileStorageActivationStore`? This would be the equivalent class to 
`DockerToActivationFileLogStore` where you inject `namespace` via 
`additionalMetadata`.
   
   `ActivationFileStorage` is just a helper that performs writing of logs and 
activations to a file. The log store implementations that make use of 
`ActivationFileStorage` should decide which additional metadata they want to 
add. `ArtifactWithFileStorageActivationStore` is such a log store.
   
   See 
https://github.com/apache/openwhisk/blob/400a7915115576a363858788a6d080c389a80317/common/scala/src/main/scala/org/apache/openwhisk/core/database/ArtifactWithFileStorageActivationStore.scala#L58-L60
   
   ^^ I suggest to inject the additional `namespace` field here.
   
   Hint: IBM is using the `ActivationFileStorage` in a private implementation 
for IBM's logging system that requires different fields unique to IBM that do 
not make sense in the openwhisk context. That's why we want to keep 
`ActivationFileStorage` as open as possible.


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:
us...@infra.apache.org


With regards,
Apache Git Services