Groundwork to support telemetry for Akka gRPC responses#2035
Groundwork to support telemetry for Akka gRPC responses#2035
Conversation
| if (segments.hasNext()) return notFound; // we don't allow any random `/prefix/Method/anything/here | ||
| else { | ||
| return handle(spi.onRequest(prefix, method, req), method, implementation, mat, eHandler, system); | ||
| final akka.japi.Function<ActorSystem, akka.japi.Function<Throwable, Trailers>> instrumentedEHandler = s -> { |
There was a problem hiding this comment.
This means we'll allocate two lambdas for every request, while handling it/matching the path, also when SPI/telemetry is not used.
It would be better if a single callback per method has created up front on handler creation, and not happen at all if telemetry not used. That will require some tricker changes than these minimal amends though, it's not immediately obvious how to go about it to me, probably a private field per case and then use that inside the generated pattern match branches in the handle method.
There was a problem hiding this comment.
Good call. I mainly proposed this as an "as simple as possible" solution that disrupts the existing code-base as little as possible. But let me see if I can come up with something that addresses your concerns.
Lays the groundwork to be able to start gathering gRPC response metrics in Cinnamon.
References #2034