Skip to content

Groundwork to support telemetry for Akka gRPC responses#2035

Open
jackgene wants to merge 2 commits intoakka:mainfrom
jackgene:record-grpc-status-code-metrics
Open

Groundwork to support telemetry for Akka gRPC responses#2035
jackgene wants to merge 2 commits intoakka:mainfrom
jackgene:record-grpc-status-code-metrics

Conversation

@jackgene
Copy link

@jackgene jackgene commented Mar 1, 2025

Lays the groundwork to be able to start gathering gRPC response metrics in Cinnamon.

References #2034

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 -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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