-
Notifications
You must be signed in to change notification settings - Fork 870
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
Support for Akka HTTP connection source #6081
Comments
@zackman0010 feel free to submit a PR |
We're still testing our implantation internally, but we'll be submitting a PR as soon as we're done! We're actually running into a strange issue right now. We're calling Do you have any suggestions on why this might be happening? We can go ahead and push our PR if you'd need to see code. |
hi @zackman0010, it sounds most likely that you are leaking a Scope, meaning you are setting the context as current (which binds it to thread local) and then not closing the associated scope in the same thread. it's best to always call makeCurrent in a try-with-resources block, or if you are inside of bytebuddy advice it's a little tricker, but make sure you are starting the scope in OnMethodEnter, passing the Scope object to OnMethodExit and closing it there |
That sounds very plausible, I know Akka doesn't play well with ThreadLocals. The comment on the existing Akka instrumentation about there being no clean way to handle closing scopes is making more sense now as well. We'll keep looking into this, see if we can find a way around it. |
We successfully found a workaround to fix the scope leakage. Akka has the concept of a We were able to use instrumentation to inject a new PinnedDispatcher into the configuration, then have have the wrapper we made utilize our dispatcher instead of Akka's default dispatcher. This fixed the Scope leakage issue that we were previously seeing. We created PR #6109 for both this issue and the issue described in #5137, as both could be fixed with the same dispatcher/wrapper combination. |
Currently, the Akka HTTP instrumentation only supports using
.bindAndHandleSync
and.bindAndHandleAsync
methods (.bind
and.bindAsync
in Akka HTTP 10.2's new ServerBuilder methods). I'd like to add support for the connection source method (Http().bind
in 10.0 and 10.1,builder.connectionSource()
in 10.2).The connection source method works by providing the user with a Source[Http.IncomingConnection]. We can instrument this class's .handleWith function to wrap the handler in instrumentation.
The instrumentation required to wrap .handleWith can also be used to complete #5137, as they require wrapping a handler of type Flow.
We're currently internally testing an implementation of this instrumentation, but decided to create this issue first for feedback as recommended in the contributing guidelines.
The text was updated successfully, but these errors were encountered: