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 2018/06/21 11:13:30 UTC

[GitHub] rabbah commented on a change in pull request #3552: Emit activation metadata to Kafka

rabbah commented on a change in pull request #3552: Emit activation metadata to Kafka
URL: https://github.com/apache/incubator-openwhisk/pull/3552#discussion_r197094712
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
 ##########
 @@ -358,10 +362,37 @@ protected[core] abstract class EntitlementProvider(config: WhiskConfig, loadBala
   private def checkThrottleOverload(throttle: Future[RateLimit], user: Identity)(
     implicit transid: TransactionId): Future[Unit] = {
     throttle.flatMap { limit =>
+      val userId = user.authkey.uuid
       if (limit.ok) {
+        limit match {
+          case c: ConcurrentRateLimit => {
+            val metric =
+              Metric("ConcurrentInvocations", c.count + 1)
+            UserEvents.send(
+              eventProducer,
+              EventMessage(
+                s"controller${controllerInstance.instance}",
+                metric,
+                user.subject,
+                user.namespace.toString,
+                userId,
+                metric.typeName))
+          }
+          case _ => // ignore
+        }
         Future.successful(())
       } else {
         logging.info(this, s"'${user.namespace}' has exceeded its throttle limit, ${limit.errorMsg}")
+        val metric = Metric(limit.limitName, 1)
+        UserEvents.send(
+          eventProducer,
+          EventMessage(
+            s"controller${controllerInstance.instance}",
+            metric,
+            user.subject,
+            user.namespace.toString,
+            userId,
+            metric.typeName))
 
 Review comment:
   already passing in a `metric` why bother with the `typeName`?

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


With regards,
Apache Git Services