始めに 前回の延長でちょっと分かりにくいgrpc-goのInterceptorを使ってみようと思います。 参考:go-grpc-middleware Interceptorとは WebFramework系で言うとこのMiddlewareという認識で良いのではないかと思います。RPCメソッドの呼出に割り込んで事前・事後処理を実行することができます。 サーバーサイド・クライアントサイドどちらでも使えるようですが、今回はサーバーサイドのみに使っています。 ※grpc-goのソースにまだ実験的なものとあったので今後に注意必要かも 実装 InterceptorにはUnaryInterceptorとStreamInterceptorの2種類が用意されており、単純なリクエストとリプライを返すRPCメソッドにはUnaryInterceptorを、Streamを使うRPCメソッドにはStreamInterc