You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/11/20 07:48:57 UTC

[GitHub] [openwhisk] neerajmangal commented on a change in pull request #4726: Recording metrics for action result response statusCode in user-events service.

neerajmangal commented on a change in pull request #4726: Recording metrics for action result response statusCode in user-events service. 
URL: https://github.com/apache/openwhisk/pull/4726#discussion_r348330670
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/connector/Message.scala
 ##########
 @@ -340,7 +345,22 @@ object Activation extends DefaultJsonProtocol {
       "conductor",
       "memory",
       "causedBy",
-      "size")
+      "size",
+      "actionStatusCode")
+
+  /** Get "StatusCode" from result response **/
+  def getActivationStatusCode(result: Option[JsValue]): Option[Int] = {
+    val statusCode = JsHelpers.getFieldPath(result.get.asJsObject, ERROR_FIELD, "statusCode")
+
+    statusCode match {
+      case Some(value) => Some(value.convertTo[Int])
+      case None =>
+        JsHelpers.getFieldPath(result.get.asJsObject, "statusCode") match {
+          case Some(value) => Some(value.convertTo[Int])
+          case None        => None
+        }
 
 Review comment:
   Sure, will try your suggestion.

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


With regards,
Apache Git Services