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

Upgrade to Scala 2.13.6 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

milanvdm
Copy link

I've built elastic/apm-agent-java#1918 locally and used it for your project.

From what I can tell, the post-requests are traced correctly.

The get-requests are not traced correctly due to the akka-actors. Ill check if it is still traced correctly when I remove the actors and use Futures instead.

Other apm tools specifically instrument akka-actors so I assume there is some context-switching happing there as well: https://github.com/kamon-io/Kamon/tree/master/instrumentation/kamon-akka/src/akka-2.6/scala/kamon/instrumentation/akka/instrumentations/akka_26

@henrikno
Copy link
Owner

henrikno commented Aug 5, 2021

Thank you for this!
I built elastic/apm-agent-java#1918 locally and built this PR, but I'm still seeing issues with the post request (which does use akka-actors).
First request two gives a warning about not properly deactivating spans

transaction-id: 3167cd8ed420110f Starting transaction 3167cd8ed420110f thread=204
transaction-id: 3167cd8ed420110f UserRegistry.CreateUser  thread=203
transaction-id: 3167cd8ed420110f Ending transaction 3167cd8ed420110f thread=203
2021-08-04 17:03:56,596 [HelloAkkaHttpServer-akka.actor.default-dispatcher-11] WARN  co.elastic.apm.agent.impl.ElasticApmTracer - Deactivating a span ('POST /users' 00-cf6d96595a05a738e8c672ec9e2e7692-3167cd8ed420110f-01 (3346b27d)) which is not the currently active span (null). This can happen when not properly deactivating a previous span.
ransaction-id: d49f322439f7ad06 Starting transaction d49f322439f7ad06 thread=258
transaction-id: d49f322439f7ad06 UserRegistry.CreateUser  thread=259
transaction-id: d49f322439f7ad06 Ending transaction d49f322439f7ad06 thread=262
2021-08-04 17:17:01,858 [HelloAkkaHttpServer-akka.actor.default-dispatcher-20] WARN  co.elastic.apm.agent.impl.ElasticApmTracer - Deactivating a span ('POST /users' 00-1c5eb2dd1e0ba3c26d9a4ce7d0c57711-d49f322439f7ad06-01 (1bd8499e)) which is not the currently active span (null). This can happen when not properly deactivating a previous span.

Third request didn't but the transaction id is wrong

transaction-id: d49f322439f7ad06 Starting transaction d3cd93f208a4e976 thread=258
transaction-id: d3cd93f208a4e976 UserRegistry.CreateUser  thread=273
transaction-id: d49f322439f7ad06 Ending transaction d3cd93f208a4e976 thread=258

I don't get how ElasticApm.currentTransaction().getId can give different results than transaction.getId right after running activate.
But I guess it's related to the earlier warnings.
Scope.activate() docs do say Note: activate() and Scope.close() have to be called on the same thread. but I don't get how we can do that on an async http server with a thread pool?
(Btw. I managed to get this Warn with just Future.map as well, although less often because it often happens to batch them on the same thread)

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

Successfully merging this pull request may close these issues.

2 participants