diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-01-12 01:45:27 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-01-24 23:19:01 +0100 |
commit | 01a34f67ff75419c440f2e69c0a0db888a670a34 (patch) | |
tree | 9c4dee4e9c13c26937356950f9e4927c3f9dfb7d /kamon-playground/src/main/scala | |
parent | 4a47e92d23af371f1d50b40af6cbe00a5ffc0105 (diff) | |
download | Kamon-01a34f67ff75419c440f2e69c0a0db888a670a34.tar.gz Kamon-01a34f67ff75419c440f2e69c0a0db888a670a34.tar.bz2 Kamon-01a34f67ff75419c440f2e69c0a0db888a670a34.zip |
! all: improve the metric recorders infrastructure
Diffstat (limited to 'kamon-playground/src/main/scala')
-rw-r--r-- | kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala index eda02f4e..94c91a8a 100644 --- a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala +++ b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala @@ -20,10 +20,10 @@ import akka.actor._ import akka.routing.RoundRobinPool import akka.util.Timeout import kamon.Kamon -import kamon.metric.Subscriptions.TickMetricSnapshot +import kamon.metric.SubscriptionsDispatcher.TickMetricSnapshot import kamon.metric._ import kamon.spray.KamonTraceDirectives -import kamon.trace.{ Trace, SegmentCategory, TraceRecorder } +import kamon.trace.{ TraceContext, SegmentCategory } import spray.http.{ StatusCodes, Uri } import spray.httpx.RequestBuilding import spray.routing.SimpleRoutingApp @@ -46,27 +46,9 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil def receive: Actor.Receive = { case any ⇒ sender ! any } }), "com") - Kamon(Trace).subscribe(printer) - //val buffer = system.actorOf(TickMetricSnapshotBuffer.props(30 seconds, printer)) - - //Kamon(Metrics).subscribe(CustomMetric, "*", buffer, permanently = true) - //Kamon(Metrics).subscribe(ActorMetrics, "*", printer, permanently = true) - implicit val timeout = Timeout(30 seconds) - val counter = Kamon(UserMetrics).registerCounter("requests") - Kamon(UserMetrics).registerCounter("requests-2") - Kamon(UserMetrics).registerCounter("requests-3") - - Kamon(UserMetrics).registerHistogram("histogram-1") - Kamon(UserMetrics).registerHistogram("histogram-2") - - Kamon(UserMetrics).registerMinMaxCounter("min-max-counter-1") - Kamon(UserMetrics).registerMinMaxCounter("min-max-counter-2") - Kamon(UserMetrics).registerMinMaxCounter("min-max-counter-3") - - //Kamon(UserMetrics).registerGauge("test-gauge")(() => 10L) - + val counter = Kamon(UserMetrics).counter("requests") val pipeline = sendReceive val replier = system.actorOf(Props[Replier].withRouter(RoundRobinPool(nrOfInstances = 4)), "replier") @@ -133,7 +115,7 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil } ~ path("segment") { complete { - val segment = TraceRecorder.currentContext.startSegment("hello-world", SegmentCategory.HttpClient, "none") + val segment = TraceContext.currentContext.startSegment("hello-world", SegmentCategory.HttpClient, "none") (replier ? "hello").mapTo[String].onComplete { t ⇒ segment.finish() } @@ -179,7 +161,7 @@ object Verifier extends App { class Replier extends Actor with ActorLogging { def receive = { case anything ⇒ - if (TraceRecorder.currentContext.isEmpty) + if (TraceContext.currentContext.isEmpty) log.warning("PROCESSING A MESSAGE WITHOUT CONTEXT") //log.info("Processing at the Replier, and self is: {}", self) |