aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2016-03-14 21:59:02 +0100
committerIvan Topolnjak <ivantopo@gmail.com>2016-03-14 21:59:02 +0100
commitaa93757d615d805a9b6c30541055601b0df22951 (patch)
treee0e12d34daaa09a29b5df8880d96d6b4df95fbde
parent05c38b4aba959c0c9aa4def450fb734a03b4e4b9 (diff)
downloadKamon-aa93757d615d805a9b6c30541055601b0df22951.tar.gz
Kamon-aa93757d615d805a9b6c30541055601b0df22951.tar.bz2
Kamon-aa93757d615d805a9b6c30541055601b0df22951.zip
introduce selective instrumentation for akka actors.
-rw-r--r--kamon-core/src/main/scala/kamon/ModuleLoader.scala2
-rw-r--r--kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala6
-rw-r--r--kamon-core/src/main/scala/kamon/util/Timestamp.scala6
3 files changed, 14 insertions, 0 deletions
diff --git a/kamon-core/src/main/scala/kamon/ModuleLoader.scala b/kamon-core/src/main/scala/kamon/ModuleLoader.scala
index a89af19e..55874a33 100644
--- a/kamon-core/src/main/scala/kamon/ModuleLoader.scala
+++ b/kamon-core/src/main/scala/kamon/ModuleLoader.scala
@@ -46,6 +46,8 @@ private[kamon] class ModuleLoaderExtension(system: ExtendedActorSystem) extends
case th: Throwable ⇒ log.error(s"Failed to auto start the [$name] module.", th)
}
+ case other =>
+
}
// When AspectJ is present the kamon.supervisor.AspectJPresent aspect will make this return true.
diff --git a/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala b/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala
index 15e20d1a..e1e89b79 100644
--- a/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala
+++ b/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala
@@ -34,6 +34,12 @@ trait EntityRecorderFactory[T <: EntityRecorder] {
def createRecorder(instrumentFactory: InstrumentFactory): T
}
+abstract class EntityRecorderFactoryCompanion[T <: EntityRecorder](val category: String, builder: (InstrumentFactory) => T)
+ extends EntityRecorderFactory[T] {
+
+ def createRecorder(instrumentFactory: InstrumentFactory): T = builder(instrumentFactory)
+}
+
object EntityRecorderFactory {
def apply[T <: EntityRecorder](entityCategory: String, factory: InstrumentFactory ⇒ T): EntityRecorderFactory[T] =
new EntityRecorderFactory[T] {
diff --git a/kamon-core/src/main/scala/kamon/util/Timestamp.scala b/kamon-core/src/main/scala/kamon/util/Timestamp.scala
index eadc6690..5a192304 100644
--- a/kamon-core/src/main/scala/kamon/util/Timestamp.scala
+++ b/kamon-core/src/main/scala/kamon/util/Timestamp.scala
@@ -59,6 +59,8 @@ object MilliTimestamp {
* timestamp in nanoseconds.
*/
class NanoTimestamp(val nanos: Long) extends AnyVal {
+ def -(that: NanoTimestamp) = new NanoTimestamp(nanos - that.nanos)
+ def +(that: NanoTimestamp) = new NanoTimestamp(nanos + that.nanos)
override def toString: String = String.valueOf(nanos) + ".nanos"
}
@@ -70,6 +72,8 @@ object NanoTimestamp {
* Number of nanoseconds between a arbitrary origin timestamp provided by the JVM via System.nanoTime()
*/
class RelativeNanoTimestamp(val nanos: Long) extends AnyVal {
+ def -(that: RelativeNanoTimestamp) = new RelativeNanoTimestamp(nanos - that.nanos)
+ def +(that: RelativeNanoTimestamp) = new RelativeNanoTimestamp(nanos + that.nanos)
override def toString: String = String.valueOf(nanos) + ".nanos"
def toMilliTimestamp: MilliTimestamp =
@@ -77,6 +81,8 @@ class RelativeNanoTimestamp(val nanos: Long) extends AnyVal {
}
object RelativeNanoTimestamp {
+ val zero = new RelativeNanoTimestamp(0L)
+
def now: RelativeNanoTimestamp = new RelativeNanoTimestamp(System.nanoTime())
def relativeTo(milliTimestamp: MilliTimestamp): RelativeNanoTimestamp =
new RelativeNanoTimestamp(now.nanos - (MilliTimestamp.now.millis - milliTimestamp.millis) * 1000000)