0

I am trying to develop an Akka application using Scala and I would like to log the application behavior using Lightbend Telemetry: Cinnamon Grafana + Prometheus.

I set up everything with sbt following this tutorial https://developer.lightbend.com/docs/telemetry/current//setup/cinnamon-agent-sbt.html

Eveything works well, but Cinnamon only starts when I run my application from command line using

sbt clean compile
sbt run

And I can see the logs in the console

[info] [INFO] [02/14/2022 10:58:15.480] [main-1] [Cinnamon] Agent version 2.16.2
[info] [INFO] [02/14/2022 10:58:16.362] [main-1] [Cinnamon] Agent found Java Futures version: 1.8.0_311
[info] [INFO] [02/14/2022 10:58:16.436] [main-1] [Cinnamon] Agent found Scala version: 2.13.8
[info] [INFO] [02/14/2022 10:58:16.436] [main-1] [Cinnamon] Agent found Scala Futures version: 2.13.8

When I run it from IntelliJ (run) or when I build the fat jar through set-assembly and run it with java -jar, Cinnamon does not start.

Anyone that can help me understanding why?

user3476509
  • 171
  • 10
  • Hey! I want to add cinnamon to my project, but I don't find it anywhere on maven repos or elsewhere. If you have, would you please send the link? – AMK Jun 23 '22 at 15:53
  • @AMK follow this article: https://medium.com/akka-scala/akka-monitor-your-applications-with-lightbend-telemetry-prometheus-and-grafana-dashboard-1b7353e281c1 – user3476509 Jun 30 '22 at 14:08
  • Thanks for your reply. I would give it a try but as much as I tried, I couldn't satisfy com.lightbend.cinnamon dependency. Allegedly, it's been removed – AMK Jun 30 '22 at 15:48
  • @AMK It does not work with Scala 3 yet. And for Scala 2 to work, you would need the Lightbend Commercial Credentials. – user3476509 Jun 30 '22 at 17:45
  • Can you give me the link to its JAR file or something like this? – AMK Jun 30 '22 at 19:03
  • @AMK Unfortunately not, it is a commercial product and you need the license for it – user3476509 Jul 01 '22 at 18:50

1 Answers1

1

It boils down to passing -javaagent switch when starting jvm.

sbt can do it for you when you run the app via sbt run. When you run it from intellij or packaged jar, that switch is not passed to jvm and therefore the Cinnamon is not running.

In intellij you can go to run configuration and add the -javaagent path/to/cinnamon-agent.jar in config. if you run your jar via java jar your-jar.jar just add the switch to command line.

artur
  • 1,710
  • 1
  • 13
  • 28