aboutsummaryrefslogtreecommitdiff
path: root/kamon-core
diff options
context:
space:
mode:
authorIvan Topolnak <itopolnak@despegar.com>2014-02-06 10:23:34 -0300
committerIvan Topolnak <itopolnak@despegar.com>2014-02-06 10:48:34 -0300
commit679b0dcb8e715a2e7e3226b05755931453cf510d (patch)
treeb9bd0803ef49cebc736f54862789e5680e09c9e5 /kamon-core
parent522a12c90788c402a364407e146d302e6519a3da (diff)
downloadKamon-679b0dcb8e715a2e7e3226b05755931453cf510d.tar.gz
Kamon-679b0dcb8e715a2e7e3226b05755931453cf510d.tar.bz2
Kamon-679b0dcb8e715a2e7e3226b05755931453cf510d.zip
minor cleanup before relasing 0.0.13
Diffstat (limited to 'kamon-core')
-rw-r--r--kamon-core/src/main/scala/kamon/metrics/Subscriptions.scala20
-rw-r--r--kamon-core/src/main/scala/kamon/metrics/package.scala4
-rw-r--r--kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala3
3 files changed, 12 insertions, 15 deletions
diff --git a/kamon-core/src/main/scala/kamon/metrics/Subscriptions.scala b/kamon-core/src/main/scala/kamon/metrics/Subscriptions.scala
index 2111563b..4b022377 100644
--- a/kamon-core/src/main/scala/kamon/metrics/Subscriptions.scala
+++ b/kamon-core/src/main/scala/kamon/metrics/Subscriptions.scala
@@ -16,10 +16,10 @@
package kamon.metrics
-import akka.actor.{Props, ActorRef, Actor}
+import akka.actor.{ Props, ActorRef, Actor }
import kamon.metrics.Subscriptions.{ MetricGroupFilter, FlushMetrics, TickMetricSnapshot, Subscribe }
import kamon.util.GlobPathFilter
-import scala.concurrent.duration.{FiniteDuration, Duration}
+import scala.concurrent.duration.{ FiniteDuration, Duration }
import java.util.concurrent.TimeUnit
import kamon.Kamon
import kamon.metrics.TickMetricSnapshotBuffer.FlushBuffer
@@ -88,38 +88,36 @@ object Subscriptions {
}
}
-
class TickMetricSnapshotBuffer(flushInterval: FiniteDuration, receiver: ActorRef) extends Actor {
val flushSchedule = context.system.scheduler.schedule(flushInterval, flushInterval, self, FlushBuffer)(context.dispatcher)
def receive = empty
def empty: Actor.Receive = {
- case tick : TickMetricSnapshot => context become(buffering(tick))
- case FlushBuffer => // Nothing to flush.
+ case tick: TickMetricSnapshot ⇒ context become (buffering(tick))
+ case FlushBuffer ⇒ // Nothing to flush.
}
def buffering(buffered: TickMetricSnapshot): Actor.Receive = {
- case TickMetricSnapshot(_, to, tickMetrics) =>
+ case TickMetricSnapshot(_, to, tickMetrics) ⇒
val combinedMetrics = combineMaps(buffered.metrics, tickMetrics)(mergeMetricGroup)
val combinedSnapshot = TickMetricSnapshot(buffered.from, to, combinedMetrics)
- context become(buffering(combinedSnapshot))
+ context become (buffering(combinedSnapshot))
- case FlushBuffer =>
+ case FlushBuffer ⇒
receiver ! buffered
- context become(empty)
+ context become (empty)
}
-
override def postStop(): Unit = {
flushSchedule.cancel()
super.postStop()
}
def mergeMetricGroup(left: MetricGroupSnapshot, right: MetricGroupSnapshot) = new MetricGroupSnapshot {
- val metrics = combineMaps(left.metrics, right.metrics)((l, r) => l.merge(r))
+ val metrics = combineMaps(left.metrics, right.metrics)((l, r) ⇒ l.merge(r))
}
}
diff --git a/kamon-core/src/main/scala/kamon/metrics/package.scala b/kamon-core/src/main/scala/kamon/metrics/package.scala
index 765ebaca..f89d84a3 100644
--- a/kamon-core/src/main/scala/kamon/metrics/package.scala
+++ b/kamon-core/src/main/scala/kamon/metrics/package.scala
@@ -18,9 +18,9 @@ package kamon
package object metrics {
- def combineMaps[K, V](left: Map[K, V], right: Map[K, V])(valueMerger: (V, V) => V): Map[K, V] = {
+ def combineMaps[K, V](left: Map[K, V], right: Map[K, V])(valueMerger: (V, V) ⇒ V): Map[K, V] = {
(left ++ right) map {
- case (key, rightValue) => key -> left.get(key).map(leftValue => valueMerger(leftValue, rightValue)).getOrElse(rightValue)
+ case (key, rightValue) ⇒ key -> left.get(key).map(leftValue ⇒ valueMerger(leftValue, rightValue)).getOrElse(rightValue)
}
}
}
diff --git a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
index 03c1f323..ad9fd13f 100644
--- a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
+++ b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
@@ -1,5 +1,4 @@
-/*
- * =========================================================================================
+/* =========================================================================================
* Copyright © 2013 the kamon project <http://kamon.io/>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file