From 1cfe038ff70cc459515d2ee6eb3ae216c823ec47 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Thu, 29 Jan 2015 22:47:17 +0100 Subject: + core: add create and shutdown methods to Kamon. --- kamon-core/src/main/scala/kamon/Kamon.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'kamon-core') diff --git a/kamon-core/src/main/scala/kamon/Kamon.scala b/kamon-core/src/main/scala/kamon/Kamon.scala index f07f846b..d29061f8 100644 --- a/kamon-core/src/main/scala/kamon/Kamon.scala +++ b/kamon-core/src/main/scala/kamon/Kamon.scala @@ -24,12 +24,18 @@ class Kamon(val actorSystem: ActorSystem) { val metrics: MetricsExtension = Metrics.get(actorSystem) val tracer: TracerExtension = Tracer.get(actorSystem) val userMetrics: UserMetricsExtension = UserMetrics.get(actorSystem) + + def shutdown: Unit = + actorSystem.shutdown() } object Kamon { trait Extension extends actor.Extension def apply[T <: Extension](key: ExtensionId[T])(implicit system: ActorSystem): T = key(system) + def apply(): Kamon = + apply("kamon") + def apply(actorSystemName: String): Kamon = apply(ActorSystem(actorSystemName)) @@ -38,4 +44,17 @@ object Kamon { def apply(system: ActorSystem): Kamon = new Kamon(system) + + def create(): Kamon = + apply() + + def create(actorSystemName: String): Kamon = + apply(ActorSystem(actorSystemName)) + + def create(actorSystemName: String, config: Config): Kamon = + apply(ActorSystem(actorSystemName, config)) + + def create(system: ActorSystem): Kamon = + new Kamon(system) + } \ No newline at end of file -- cgit v1.2.3