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

Kamon on Lagom projects #563

Open
tapaswenipathak opened this issue Nov 24, 2018 · 12 comments
Open

Kamon on Lagom projects #563

tapaswenipathak opened this issue Nov 24, 2018 · 12 comments

Comments

@tapaswenipathak
Copy link

tapaswenipathak commented Nov 24, 2018

Hello, I'm adding Kamon to a Lagom project. The logs does not have any errors but kamon isn't loading for the project. I debugged and looked a bit and found this project. Does kamon work for lagom projects? didn't find specific info for kamon on lagom in the docs or some projects on GitHub.

@tapaswenipathak tapaswenipathak changed the title Kamon for Lagom projects Kamon on Lagom projects Nov 24, 2018
@kuzkdmy
Copy link

kuzkdmy commented Dec 20, 2018

I got the same problem, this was really working with pure akka based project, but not working with play and lagom.
Thanks.

addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.4.9")
addSbtPlugin("io.kamon" % "sbt-aspectj-runner-play-2.6" % "1.1.0")
addSbtPlugin("io.kamon" % "sbt-aspectj-runner" % "1.1.0")
addSbtPlugin("com.lightbend.sbt" % "sbt-javaagent" % "0.1.4")

"io.kamon" %% "kamon-play-2.6" % "1.0.1",

 javaAgents += "org.aspectj" % "aspectjweaver" % "1.9.2",
javaOptions += "-Dorg.aspectj.tracing.factory=default -Xset:weaveJavaxPackages=false",

@kuzkdmy
Copy link

kuzkdmy commented Dec 27, 2018

Contacted Kamon Team, Many thanks to @ivantopo
default

@ivantopo
Copy link
Contributor

Just for the record, I did look into this but it is a bit more complicated than it sounds.. hope to have some more information asap!

@two10
Copy link

two10 commented Feb 12, 2019

any update on this, as we want to use Lagom in production but cannot go live without distributed tracing

@ihostage
Copy link
Contributor

Comment from @ivantopo in Gitter:

I have seen the Play/Akka HTTP instrumentation work in Lagom applications, what doesn't work is instrumenting applications while running them on development mode.. that's a big down right there, but it doesn't mean it wont work in production mode

@ivantopo
Copy link
Contributor

You folks might also want to take a look at these messages: https://gitter.im/kamon-io/Kamon?at=5c75b7be0966d91204eef221

@dpennell
Copy link

dpennell commented Dec 7, 2019

I don't use Lagom dev mode. I can almost get Kamon to almost work in production mode (distribution created by sbt-nativepacker).

I have .enablePlugin(JavaAgent) on my app project, but this doesn't result in Kamon being initialized. If I use Kamon.init() in the application class, Kamon starts but then I see:

Error in stage [akka.http.impl.engine.server.HttpServerBluePrint$RequestTimeoutSupport@4ab2e092]: scala.util.Success cannot be cast to kamon.instrumentation.context.HasContext

I see the kanela agent being extracted to my temp dir, but I don't see a -javaagent flag in the startup script generated by sbt-nativepackager. I'm not sure at which point the agent jar is extracted to the temp dir, but it has a dynamic generated name that seems to be at odds with using -javaagent.

ihostage added a commit to ihostage/Kamon that referenced this issue Apr 2, 2020
ihostage added a commit to ihostage/Kamon that referenced this issue Apr 8, 2020
@leozilla
Copy link

I get the same error as @dpennell when running with Lagom 1.6.2
Also the setup is the same. I added the JavaAgent to the plugins and I also need to call Kamon.init() explicitly otherwise I dont see that Kanela is loaded.

@leozilla
Copy link

I just managed to get it working by adding javaAgents += "io.kamon" % "kanela-agent" % "1.0.6" to my build.sbt.
This way I also dont need to call Kamon.init() anymore when running with prod config.

@ivantopo
Copy link
Contributor

hey @leozilla, @dpennell

I'm guessing that the plugin doesn't get triggered because of the dependency in PlayWeb from our SBT plugin.

A few months ago, I spent a couple days really trying to get this working in development mode, but I remember having major issues with the fact that in development mode there could be more than one service running on the same JVM, just with different classloaders, and not all the classloaders might have Kamon in them. Kanela, on the other side, expects having only one application per JVM and trying to resolve that clash would be a non-trivial effort.

It seems like the right thing to do is explain to people how to enable Kamon in Lagom projects in production mode and make it clear that it will just not work in dev mode. A lot of people would be happy anyways!

ihostage added a commit to ihostage/Kamon that referenced this issue May 28, 2021
ihostage added a commit to ihostage/Kamon that referenced this issue May 31, 2021
ihostage added a commit to ihostage/Kamon that referenced this issue Jun 11, 2021
ihostage added a commit to ihostage/Kamon that referenced this issue Oct 26, 2021
ihostage added a commit to ihostage/Kamon that referenced this issue Oct 26, 2021
ihostage added a commit to ihostage/Kamon that referenced this issue Oct 29, 2021
ihostage added a commit to ihostage/Kamon that referenced this issue Jan 12, 2022
@randers-bit
Copy link

Hello, i saw lagom instrumentation in this project and tried to add this to my lagom deployment.
I added dependency (kamon-lagom) and changed value in configuration to value proposed in reference-overrides.conf.
On kamon status page i see only application/lagom.persistence.dispatcher module. I saw in code that this project should add circuit brearker metrics.

It is not added to status page or i need to manually turn this metrics on?

@ihostage
Copy link
Contributor

@Randerspl Yes, kamon-lagom adds only metrics for circuit breakers. For other Kamon features you need to add other Kamon modules like Play and Akka.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants