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

Trying to load Akka instrumentation when using Pekko in Scala 3 #1332

Open
drenizg opened this issue Apr 1, 2024 · 4 comments
Open

Trying to load Akka instrumentation when using Pekko in Scala 3 #1332

drenizg opened this issue Apr 1, 2024 · 4 comments
Assignees

Comments

@drenizg
Copy link

drenizg commented Apr 1, 2024

Hi,

I'm moving my Pekko project to Scala 3.3.3, and when I run it, it throws this warning (Only for Scala 3; same code runs fine when compiled with Scala 2.13):

[Attach Listener] WARNING 2024-04-01 08:16:53  Logger : Error trying to load Instrumentation: kamon.instrumentation.akka.instrumentations.akka_25.DispatcherInstrumentation with error: java.lang.ClassNotFoundException: kamon.instrumentation.akka.instrumentations.akka_25.DispatcherInstrumentation 
[Attach Listener] WARNING 2024-04-01 08:16:53  Logger : Error trying to load Instrumentation: kamon.instrumentation.akka.instrumentations.akka_25.remote.RemotingInstrumentation with error: java.lang.ClassNotFoundException: kamon.instrumentation.akka.instrumentations.akka_25.remote.RemotingInstrumentation 
[2024-04-01 08:16:54,498] [INFO] [kamon.status.page.StatusPage] [] [main] - Status Page started on http://0.0.0.0:5266/ MDC: {}
[2024-04-01 08:16:54,753] [INFO] [kamon.prometheus.PrometheusReporter] [] [main] - Started the embedded HTTP server on http://0.0.0.0:9095/metrics MDC: {}
[2024-04-01 08:16:54,801] [INFO] [kamon.Init] [] [main] - 
 _
| |
| | ____ _ _ __ ___   ___  _ __
| |/ / _  |  _ ` _ \ / _ \|  _ \
|   < (_| | | | | | | (_) | | | |
|_|\_\__,_|_| |_| |_|\___/|_| |_|
=====================================
Initializing Kamon Telemetry v2.7.1 / Kanela v1.0.18
 MDC: {}

As a workaround, I successfully disabled those modules in application.conf file:

kanela.modules {
  akka.enabled = false
  akka-remote.enabled = false
}

Any ideas on why is it trying to load Akka instrumentation in a Pekko project with no Akka dependencies?

@Dichotomia
Copy link

I confirm this issue.

@Philippus
Copy link
Contributor

I'm guessing you're using the kamon-bundle dependency?
I think this is because the kamon-akka reference.conf has these lines:

      "kamon.instrumentation.akka.instrumentations.akka_25.DispatcherInstrumentation",
      "kamon.instrumentation.akka.instrumentations.akka_26.DispatcherInstrumentation",

and

      "kamon.instrumentation.akka.instrumentations.akka_25.remote.RemotingInstrumentation",
      "kamon.instrumentation.akka.instrumentations.akka_26.remote.RemotingInstrumentation"

but the akka 2.5 instrumentation is not in the kamon-bundle for scala 3 (because there is no akka 2.5 for scala 3).
The reverse is true for scala 2.11, there is no akka 2.6 instrumentation for scala 2.11 (because there is no akka 2.6 for scala 2.11)

Maybe scala 2.11 and akka 2.5 could be dropped.

@mgralle
Copy link

mgralle commented Dec 16, 2024

In addition to enabling kamon pekko, you need to explicitly remove the kamon-akka modules, e.g.:

kanela.modules {

  akka {
    name = "Akka Instrumentation"
    enabled = no
  }
  akka-remote {
    name = "Akka Remote Instrumentation"
    enabled = no
  }
  akka-remote-sharding {
    name = "Akka Remote Cluster Sharding Monitoring"
    enabled = no
  }
  akka-grpc {
    name = "Akka gRPC Instrumentation"
    enabled = no
  }
  akka-http {
    name = "Akka HTTP Instrumentation"
    enabled = no
  }

It took me a long time to figure this out!

@drenizg
Copy link
Author

drenizg commented Dec 16, 2024

Right, that's the workaround I mentioned in the issue. However, I'm not sure that should be the way to handle this scenario. If the community think it is, at least that should be clearly stated somewhere in the docs.

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

No branches or pull requests

5 participants