question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Akka HTTP connection source

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zackman0010commented, May 25, 2022

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.

1reaction
traskcommented, May 25, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration • Akka HTTP - Documentation
Akka Http : Modern, fast, asynchronous, streaming-first HTTP server and client.
Read more >
Connection-Level Client-Side API • Akka HTTP - Documentation
The connection-level API is the lowest-level client-side API Akka HTTP provides. It gives you full control over when HTTP connections are opened and...
Read more >
Configuration • Akka HTTP - Documentation
Akka Http : Modern, fast, asynchronous, streaming-first HTTP server and client.
Read more >
Client-Side HTTPS Support • Akka HTTP - Documentation
Akka HTTP supports TLS encryption on the client-side as well as on the server-side. The central vehicle for configuring encryption is the HttpsConnectionContext ......
Read more >
5. Client API • Akka HTTP - Documentation
Akka Http : Modern, fast, asynchronous, streaming-first HTTP server and client.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found