pjfanning opened a new pull request, #878: URL: https://github.com/apache/pekko-grpc/pull/878
### Motivation `TelemetrySpi.onRequest` is called from both generated server handlers — `codegen/src/main/twirl/templates/ScalaServer/Handler.scala.txt` and `codegen/src/main/twirl/templates/JavaServer/Handler.scala.txt` — but only the Scala path has a test (`interop-tests/src/test/scala/org/apache/pekko/grpc/scaladsl/TelemetrySpec.scala`). A regression in the Java handler template would go unnoticed. ### Modification Add `TelemetryTest`, the javadsl counterpart of `TelemetrySpec`: it starts an actor system with `pekko.grpc.telemetry-class` pointing at a small collecting SPI, calls the handler built by the generated `GreeterServiceHandlerFactory` with a unary `SayHello` request, and asserts the collected prefix, method and content type. `CollectingTelemetrySpi` is a separate class because the extension instantiates it reflectively. No production code is touched. ### Result The telemetry hook is covered on both generated handler paths. ### Tests - `sbt "interop-tests/testOnly org.apache.pekko.grpc.javadsl.TelemetryTest org.apache.pekko.grpc.scaladsl.TelemetrySpec"` — passed - Directional check: with `spi.onRequest(...)` removed from the Java handler template, the new test fails (`expected: <1> but was: <0>`). The template is unchanged on this branch. ### References None - test coverage for the javadsl server handler telemetry hook -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
