Upgrade go-grpc-middleware to v2.1.0 #1599
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #893.
It removes dependencies to go-grpc-middleware v1.4.0 existed in logging and recovery middlewares.
Description
Firstly, I tried to migrate the logging middleware to logging.InjectField API introduced in v2.0.0.
I couldn't complete this migration because I didn't find a way to pass Authorization Model ID from a handler to the logging middleware. Before, it was achieved by setting a key-value to the tag map and then reading all key-value pairs on the logging layer.
New API doesn't use the embedded map (as grpc_ctxtags does). Instead, it returns a context with the injected field. I didn't find a way to deliver this new context from the handler layer to PostCall function of the logging middleware.
Therefore, I decided to clone part of grpc_ctxtags middleware to the project and keep logging data propagation the same.
Upgraded grpc recovery middleware to v2. There were no breaking changes.
Metrics and traces were not affected by the upgrade.
References
Review Checklist
main