Kamon not started using sbt-aspectj-runner

388 views
Skip to first unread message

reee...@gmail.com

unread,
Jan 5, 2016, 1:32:28 AM1/5/16
to kamon-user
Hi guys,

I wanted to try out Kamon but have small issue.

In my main class I've added the starting of Kamon

object Main extends App with AppConfig with BaseService {

Kamon.start()
....

And in my build.sbt I've added your plugin

addSbtPlugin("io.kamon" % "aspectj-runner" % "0.1.2")

but it's saying kamon is not started and the api is not working. If I start it by just running manually the main class api is working just fine.

Any ideas?

MacBook-Pro:apt-billing kuzelac$ sbt aspectj-runner:run
[info] Loading project definition from /Users/kuzelac/Workspace/apt-billing/project
[info] Set current project to crudapi (in build file:/Users/kuzelac/Workspace/apt-billing/)
[info] Running hr.com.blanka.apartments.Main
[DEBUG] [01/05/2016 06:26:53.512] [run-main-0] [EventStream(akka://kamon)] logger log1-Logging$DefaultLogger started
[DEBUG] [01/05/2016 06:26:53.517] [run-main-0] [EventStream(akka://kamon)] Default Loggers started
[DEBUG] [01/05/2016 06:26:53.650] [run-main-0] [ModuleLoader(akka://kamon)] Auto starting the [kamon-system-metrics] module.
[INFO] [01/05/2016 06:26:53.660] [run-main-0] [SystemMetricsExtension(akka://kamon)] Starting the Kamon(SystemMetrics) extension
Jan 05, 2016 6:26:53 AM kamon.sigar.SigarProvisioner provision
INFO: Sigar library provisioned: /Users/kuzelac/Workspace/apt-billing/native/libsigar-universal64-macosx.dylib
[DEBUG] [01/05/2016 06:26:53.860] [run-main-0] [ModuleLoader(akka://kamon)] Auto starting the [kamon-akka] module.
[DEBUG] [01/05/2016 06:26:53.874] [run-main-0] [ModuleLoader(akka://kamon)] Auto starting the [kamon-annotation] module.
[INFO] [01/05/2016 06:26:53.879] [run-main-0] [AnnotationExtension(akka://kamon)] Starting the Kamon(Annotation) extension
[DEBUG] [01/05/2016 06:26:53.883] [run-main-0] [ModuleLoader(akka://kamon)] Auto starting the [kamon-statsd] module.
[INFO] [01/05/2016 06:26:53.896] [run-main-0] [StatsDExtension(akka://kamon)] Starting the Kamon(StatsD) extension
[DEBUG] [01/05/2016 06:26:54.009] [run-main-0] [EventStream(akka://booking)] logger log1-Logging$DefaultLogger started
[DEBUG] [01/05/2016 06:26:54.009] [run-main-0] [EventStream(akka://booking)] Default Loggers started
[DEBUG] [01/05/2016 06:26:54.448] [run-main-0] [AkkaSSLConfig(akka://booking)] Initializing AkkaSSLConfig extension...
[DEBUG] [01/05/2016 06:26:54.466] [run-main-0] [AkkaSSLConfig(akka://booking)] hostnameVerifier: com.typesafe.sslconfig.ssl.DefaultHostnameVerifier@6b584ef5
[ERROR] [01/05/2016 06:26:57.014] [booking-akka.actor.default-dispatcher-3] [akka://booking/system/IO-TCP/selectors] configuration problem while creating [akka://booking/system/IO-TCP/selectors/$a/0] with dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox]
akka.ConfigurationException: configuration problem while creating [akka://booking/system/IO-TCP/selectors/$a/0] with dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox]
at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:766)
at akka.actor.dungeon.Children$class.makeChild(Children.scala:220)
at akka.actor.dungeon.Children$class.actorOf(Children.scala:38)
at akka.actor.ActorCell.actorOf(ActorCell.scala:374)
at akka.io.SelectionHandler.spawnChildWithCapacityProtection(SelectionHandler.scala:279)
at akka.io.SelectionHandler$$anonfun$receive$1.applyOrElse(SelectionHandler.scala:238)
at akka.actor.Actor$class.aroundReceive(Actor.scala:480)
at akka.io.SelectionHandler.aroundReceive(SelectionHandler.scala:225)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke_aroundBody0(ActorCell.scala:495)
at akka.actor.ActorCell$AjcClosure1.run(ActorCell.scala:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at akka.kamon.instrumentation.ActorCellInstrumentation$$anonfun$aroundBehaviourInvoke$1.apply(ActorCellInstrumentation.scala:63)
at kamon.trace.Tracer$.withContext(TracerModule.scala:53)
at akka.kamon.instrumentation.ActorCellInstrumentation.aroundBehaviourInvoke(ActorCellInstrumentation.scala:62)
at akka.actor.ActorCell.invoke(ActorCell.scala:488)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.RuntimeException: Kamon has not been started yet. You must either explicitly call Kamon.start(...) or enable automatic startup by adding -Dkamon.auto-start=true to your JVM options.
at scala.sys.package$.error(package.scala:27)
at kamon.Kamon$.ifStarted(Kamon.scala:95)
at kamon.Kamon$.metrics(Kamon.scala:78)
at akka.kamon.instrumentation.LookupDataAware$LookupData$.apply$default$3(DispatcherInstrumentation.scala:184)
at akka.kamon.instrumentation.DispatcherInstrumentation.aroundDispatchersLookup(DispatcherInstrumentation.scala:83)
at akka.dispatch.Dispatchers.lookup(Dispatchers.scala:81)
at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:760)
... 22 more

[DEBUG] [01/05/2016 06:26:57.033] [kamon-akka.actor.default-dispatcher-5] [EventStream] shutting down: StandardOutLogger started

Diego Parra

unread,
Jan 5, 2016, 8:09:59 AM1/5/16
to kamon...@googlegroups.com
Hi reeebuuk,

that sound like an Actors System was started before kamon.start() can you check this?

I also recommend that you update the sbt-aspectj-runner to the 0.1.3 version.

BTW: here an running example.

Cheers,

Diego


--
You received this message because you are subscribed to the Google Groups "kamon-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kamon-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Krunoslav Uzelac

unread,
Jan 5, 2016, 8:22:08 AM1/5/16
to kamon...@googlegroups.com
Thx Diego for the example. Will take a look today and see if I can get it to work.

Starting of Kamon was before the starding of akka system. Like in the example.


You received this message because you are subscribed to a topic in the Google Groups "kamon-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kamon-user/8xVfOPBmzQc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kamon-user+...@googlegroups.com.

reee...@gmail.com

unread,
Jan 5, 2016, 1:58:32 PM1/5/16
to kamon-user
Hi Diego, tried the new version of plugin but nothing...

Here is the link to the project
https://bitbucket.org/kuzelac/apt-billing/overview

any ideas?

Diego Parra

unread,
Jan 6, 2016, 9:38:50 AM1/6/16
to kamon...@googlegroups.com
Hi,

i have a good and a bad news, let's start with the good:

In build.sbt you need include kamon-log-reporter dependency

"io.kamon" %% "kamon-core" % kamonVersion,
"io.kamon" %% "kamon-scala" % kamonVersion,
"io.kamon" %% "kamon-akka" % kamonVersion,
"io.kamon" %% "kamon-system-metrics" % kamonVersion,
"io.kamon" %% "kamon-annotation" % kamonVersion,
"io.kamon" %% "kamon-log-reporter" % kamonVersion,
"io.kamon" %% "kamon-statsd" % kamonVersion

then in application.conf

we need include the modules that you can run (all disabled):

 modules {
    kamon-log-reporter.auto-start = no
    kamon-statsd.auto-start = no    
    kamon-system-metrics.auto-start = no
    kamon-annotation.auto-start = no
  }


and finnally in Main.scala 

package hr.com.blanka.apartments

import akka.actor.ActorSystem
import akka.event.{Logging, LoggingAdapter}
import akka.http.scaladsl.Http
import akka.stream.ActorMaterializer
import hr.com.blanka.apartments.http.BaseService
import hr.com.blanka.apartments.price.PriceRangeActor
import hr.com.blanka.apartments.utils.{AppConfig, PricingConfig}
import kamon.Kamon

object Main extends App with AppConfig with BaseService with KamonSupport//with MongoDbConfiguration {
{
  implicit val system = ActorSystem("booking")

  val processor = system.actorOf(PriceRangeActor(PricingConfig(pricingConfig)), "processorActor")
  val view = system.actorOf(PriceRangeActor(PricingConfig(pricingConfig)), "viewActor")

  override protected implicit val executor = system.dispatcher
  override protected val log: LoggingAdapter = Logging(system, getClass)
  override protected implicit val materializer: ActorMaterializer = ActorMaterializer()

  Http().bindAndHandle(routes(processor, view), httpInterface, httpPort)
}

trait KamonSupport {
  Kamon.start()
  sys.addShutdownHook(Kamon.shutdown())
}

and if you run the application with aspectj-runner:run all is working fine....... 

The bad.... if you uncomment [with MongoDbConfiguration] the weird error appears... i need research some time more in order to find the cause.

Cheers,

Diego.

Krunoslav Uzelac

unread,
Jan 6, 2016, 1:43:23 PM1/6/16
to kamon...@googlegroups.com
Hi Diego,

thanks for taking the time to resolve my issues.

I got the same exceptions when I've been try to get it to work. Was hoping that was me doing something wrong :/

You received this message because you are subscribed to a topic in the Google Groups "kamon-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kamon-user/8xVfOPBmzQc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kamon-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages