diff options
author | John St John <johnthesaintjohn@gmail.com> | 2017-10-05 16:00:00 -0700 |
---|---|---|
committer | John St John <johnthesaintjohn@gmail.com> | 2017-10-05 16:00:00 -0700 |
commit | 329c82a14f50da68358a909c0220e47d2018b8cc (patch) | |
tree | 16d430394ff47c133d2b350875f59581a80f5941 | |
parent | 78261212035d820efe5728c15dfcd388be0c2a4b (diff) | |
download | driver-core-329c82a14f50da68358a909c0220e47d2018b8cc.tar.gz driver-core-329c82a14f50da68358a909c0220e47d2018b8cc.tar.bz2 driver-core-329c82a14f50da68358a909c0220e47d2018b8cc.zip |
Wait for tracing to flush and default to the noop tracer rather than taking an option
-rw-r--r-- | src/main/scala/xyz/driver/core/app.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/scala/xyz/driver/core/app.scala b/src/main/scala/xyz/driver/core/app.scala index 06f215a..77e35b9 100644 --- a/src/main/scala/xyz/driver/core/app.scala +++ b/src/main/scala/xyz/driver/core/app.scala @@ -49,13 +49,12 @@ object app { baseUrl: String = "localhost:8080", scheme: String = "http", port: Int = 8080, - tracer: Option[Tracer] = None)(implicit actorSystem: ActorSystem, executionContext: ExecutionContext) { + tracer: Tracer = NoTracer)(implicit actorSystem: ActorSystem, executionContext: ExecutionContext) { implicit private lazy val materializer = ActorMaterializer()(actorSystem) private lazy val http = Http()(actorSystem) val appEnvironment = config.getString("application.environment") - val serviceTracer = - tracer.getOrElse(new LoggingTracer(s => log.debug(s))) + def run(): Unit = { activateServices(modules) scheduleServicesDeactivation(modules) @@ -65,7 +64,7 @@ object app { def stop(): Unit = { http.shutdownAllConnectionPools().onComplete { _ => - serviceTracer.close() // flush out any remaining traces from the buffer + Await.result(tracer.close(), 15.seconds) // flush out any remaining traces from the buffer val _ = actorSystem.terminate() val terminated = Await.result(actorSystem.whenTerminated, 30.seconds) val addressTerminated = if (terminated.addressTerminated) "is" else "is not" @@ -137,7 +136,7 @@ object app { val _ = Future { http.bindAndHandle( route2HandlerFlow(extractHost { origin => - trace(serviceTracer) { + trace(tracer) { extractClientIP { ip => optionalHeaderValueByType[Origin](()) { |