Created
April 21, 2016 11:56
-
-
Save ivantopo/67a73a5952ce526d3fd051224c4d5ca3 to your computer and use it in GitHub Desktop.
vicaba-example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kamon { | |
metric { | |
tick-interval = 5 second | |
filters { | |
akka-actor { | |
includes = [ "**" ] | |
} | |
akka-dispatcher { | |
includes = [ "**" ] | |
} | |
akka-router { | |
includes = [ "**" ] | |
} | |
} | |
} | |
system-metrics { | |
#sigar is enabled by default | |
sigar-enabled = true | |
#jmx related metrics are enabled by default | |
jmx-enabled = true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalaVersion := "2.11.8" | |
name := "vicaba-example" | |
val kamonVersion = "0.6.0" | |
libraryDependencies ++= Seq( | |
"io.kamon" % "kamon-core_2.11" % kamonVersion, | |
"io.kamon" % "kamon-log-reporter_2.11" % kamonVersion, | |
"io.kamon" % "kamon-system-metrics_2.11" % kamonVersion, | |
"com.typesafe.akka" %% "akka-actor" % "2.4.1", | |
"com.typesafe.akka" %% "akka-slf4j" % "2.4.1", | |
"io.kamon" % "kamon-akka_2.11" % kamonVersion | |
) | |
aspectjSettings | |
javaOptions in run <++= AspectjKeys.weaverOptions in Aspectj | |
fork in run := true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kamontest | |
import akka.actor.{Props, ActorSystem, Actor} | |
import kamon.Kamon | |
import kamon.metric.SubscriptionsDispatcher.TickMetricSnapshot | |
object Main { | |
def main(args: Array[String]) { | |
Kamon.start() | |
val system = ActorSystem() | |
val subscriber = system.actorOf(Props(SimplePrinter())) | |
Kamon.metrics.subscribe("akka-actor", "**", subscriber, permanently = true) | |
Kamon.metrics.subscribe("akka-router", "**", subscriber, permanently = true) | |
Kamon.metrics.subscribe("akka-dispatcher", "**", subscriber, permanently = true) | |
Thread.sleep(30000) | |
// This application wont terminate unless you shutdown Kamon. | |
Kamon.shutdown() | |
} | |
} | |
case class SimplePrinter() extends Actor { | |
def receive = { | |
case tickSnapshot: TickMetricSnapshot => | |
println(tickSnapshot.metrics.filterKeys(_ => true)) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.10.6") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment