-
Notifications
You must be signed in to change notification settings - Fork 327
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
The instrumentation should work when using only http1 protocol #1094
The instrumentation should work when using only http1 protocol #1094
Conversation
The problem is that this code (https://github.com/akka/akka-http/blob/df3dbfbb8344844fdf4f9a2b3d8aebe3793bfc56/akka-http-core/src/main/scala/akka/http/impl/engine/http2/Http2.scala#L72-L73) is not being fully instrumented. val http1 = Flow[HttpRequest].mapAsync(settings.pipeliningLimit)(handleUpgradeRequests(handler, settings, log)).join(http.serverLayer(settings, log = log))
val http2 = Http2Blueprint.handleWithStreamIdHeader(settings.http2Settings.maxConcurrentStreams)(handler)(system.dispatcher).join(Http2Blueprint.serverStackTls(settings, log, telemetry, Http().dateHeaderRendering)) Only the http2 flow is instrumented, the http1 flow is only partially instrumented... |
@ivantopo I see you are hacking akka-http, so you might want to have a look here. At the time I was really out of ideas to properly instrument this... |
Hey @jtjeferreira! I'll dedicate a bit of time to this today. Let's see what I can do! I do remember long time ago that in order to make it work for HTTP1 AND HTTP2 at the same time we would need to copy/paste a bunch of code in a super ugly way, but maybe things changed. Let's see! |
It's me again, @jtjeferreira: Indeed, you got to the right place:
That definition of http1's flow is what we need to change, but we can't change local variables via instrumentation. The only way we could make it work is by instrumenting the entire There might be a dirty alternative, though. If we add some context around I'm going to experiment on that and see where it takes me. |
Got this to work, but there is a tiny issue: if an HTTP/1 over HTTPS request is sent to an HTTP/2-enabled server, the |
6dcd0b2
to
a9d8f90
Compare
Hey @jtjeferreira 👋 I pushed one commit to your branch with the changes and it would be awesome if you can give a try and share your experience. All tests are tied to an older version of Akka HTTP and I'm not 100% sure it is working on newer versions. I'll try to test it in the next couple days too. |
a9d8f90
to
26f1601
Compare
Hi @ivantopo. Thanks for this. I will try to have a look in the next days... |
This is just a PR to demonstrate a problem that I think I found with the akka-http instrumentation...
AFAICT akka-http with http2 preview support enabled should support both http1/1 and http2. However the instrumentation does not seem to kick in when http1/1 is used...
I will try to explore this in the next few days, but decided to raise the topic before I dig deeper...