openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvras...@apache.org
Subject [incubator-openwhisk] branch master updated: Use invoker id for metrics instead of the hostname. (#3882)
Date Thu, 19 Jul 2018 14:12:25 GMT
This is an automated email from the ASF dual-hosted git repository.

vvraskin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 1b8ffcd  Use invoker id for metrics instead of the hostname. (#3882)
1b8ffcd is described below

commit 1b8ffcd3203b38eae045a915211ad6d84cc72638
Author: Christian Bickel <github@cbickel.de>
AuthorDate: Thu Jul 19 16:12:21 2018 +0200

    Use invoker id for metrics instead of the hostname. (#3882)
    
    * Use invoker id for metrics instead of the hostname.
    
    * Review.
    
    * Review 2.
    
    * Review 3
    
    * Review 4
---
 .../main/scala/whisk/core/invoker/Invoker.scala    | 39 ++++++++++++----------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala b/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
index 4f5b341..0887727 100644
--- a/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
+++ b/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
@@ -17,28 +17,23 @@
 
 package whisk.core.invoker
 
-import scala.concurrent.Await
-import scala.concurrent.duration._
-import scala.concurrent.Future
-import scala.util.Failure
-import scala.util.Try
-import kamon.Kamon
 import akka.Done
-import akka.actor.ActorSystem
-import akka.actor.CoordinatedShutdown
+import akka.actor.{ActorSystem, CoordinatedShutdown}
 import akka.stream.ActorMaterializer
-import whisk.common.AkkaLogging
-import whisk.common.Scheduler
+import com.typesafe.config.ConfigValueFactory
+import kamon.Kamon
+import whisk.common._
 import whisk.core.WhiskConfig
 import whisk.core.WhiskConfig._
-import whisk.core.connector.MessagingProvider
-import whisk.core.connector.PingMessage
-import whisk.core.entity.ExecManifest
-import whisk.core.entity.InvokerInstanceId
+import whisk.core.connector.{MessagingProvider, PingMessage}
+import whisk.core.entity.{ExecManifest, InvokerInstanceId}
 import whisk.http.{BasicHttpService, BasicRasService}
 import whisk.spi.SpiLoader
 import whisk.utils.ExecutionContextFactory
-import whisk.common.TransactionId
+
+import scala.concurrent.duration._
+import scala.concurrent.{Await, Future}
+import scala.util.{Failure, Try}
 
 case class CmdLineArgs(uniqueName: Option[String] = None, id: Option[Int] = None, displayedName:
Option[String] = None)
 
@@ -54,9 +49,16 @@ object Invoker {
       zookeeperHosts ++
       wskApiHost
 
-  def main(args: Array[String]): Unit = {
-    Kamon.start()
+  def initKamon(instance: Int): Unit = {
+    // Replace the hostname of the invoker to the assigned id of the invoker.
+    val newKamonConfig = Kamon.config
+      .withValue(
+        "kamon.statsd.simple-metric-key-generator.hostname-override",
+        ConfigValueFactory.fromAnyRef(s"invoker$instance"))
+    Kamon.start(newKamonConfig)
+  }
 
+  def main(args: Array[String]): Unit = {
     implicit val ec = ExecutionContextFactory.makeCachedThreadPoolExecutionContext()
     implicit val actorSystem: ActorSystem =
       ActorSystem(name = "invoker-actor-system", defaultExecutionContext = Some(ec))
@@ -125,6 +127,9 @@ object Invoker {
 
         new InstanceIdAssigner(config.zookeeperHosts).getId(invokerUniqueName.get)
       }
+
+    initKamon(assignedInvokerId)
+
     val topicBaseName = "invoker"
     val topicName = topicBaseName + assignedInvokerId
     val invokerDisplayedName = cmdLineArgs.displayedName


Mime
View raw message