Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure scheduler startup in Play applications #1065

Merged
merged 1 commit into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion core/kamon-core/src/main/scala/kamon/Init.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,25 @@ trait Init { self: ModuleManagement with Configuration with CurrentStatus with M
self.moduleRegistry().init()

}


/**
* Initializes Kamon without trying to attach the instrumentation agent from the Kamon Bundle.
*/
def initWithoutAttaching(): Unit = {
self.initScheduler()
self.loadModules()
self.moduleRegistry().init()
}

/**
* Initializes Kamon without trying to attach the instrumentation agent from the Kamon Bundle.
*/
def initWithoutAttaching(config: Config): Unit = {
self.reconfigure(config)
self.initWithoutAttaching()
}


def stop(): Future[Unit] = {
self.clearRegistry()
self.stopScheduler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ object GuiceModule {
Logger(classOf[KamonLoader]).info("Reconfiguring Kamon with Play's Config")
Logger(classOf[KamonLoader]).info(configuration.underlying.getString("play.server.provider"))
Logger(classOf[KamonLoader]).info(configuration.underlying.getString("kamon.trace.tick-interval"))
Kamon.reconfigure(configuration.underlying)
Kamon.loadModules()
Kamon.initWithoutAttaching(configuration.underlying)

lifecycle.addStopHook { () =>
Logger(classOf[KamonLoader]).info("Stopping Kamon")
Expand Down