Skip to content

middleware: Log nested Repository fields

James Liu requested to merge jliu-reflect-extract-repository into master

Context

Issue: #5433 (closed)

We have gRPC middleware responsible for extracting the Repository field from incoming requests for logging purposes.

We do this by attempting to cast the request to an interface containing the corresponding GetRepository() getter function. If this cast fails, as in the case of requests with a nested Repository field, we won't be able to capture this information. Examples of high-volume RPCs with this issue are UserCommitFiles and UserRebaseConfirmableRequest.

Replace the interface casting by calling the TargetRepo() helper in protoregistry. This helper extracts the correct Repository field from requests containing multiple repositories, by finding the field with the target_repository gRPC extension set.

Edited by James Liu

Merge request reports