feat(grpc): add response size calculation option - #196
Open
jigetus wants to merge 1 commit into
Open
Conversation
Reviewer's GuideAdds an opt-out File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the option or size calculation is wrong, successful gRPC statistics can be emitted with an incorrect or zero responseSize, and those recorded metrics are not repaired by reverting. The effect is bounded to observability data; reverting restores the prior calculation for future calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Successful unary gRPC calls currently run
object-sizeofbefore resolving the response, even when an application does not use the size statistic. For large decoded responses, this adds an expensive synchronous JSON serialization pass.Add the optional
calculateResponseSizeaction setting:The default remains
true. Setting it tofalseskipssizeofand reportsresponseSize: 0(not calculated), preserving the existing numericStatscontract. Other statistics, response data and headers are unchanged. The setting applies to successful unary actions using either proto files or reflection; error statistics and streaming calls retain their existing behavior.Includes documentation and integration coverage for the omitted,
trueandfalsecases. The tests wrap the realobject-sizeofimplementation and verify that the disabled case makes no call to it.Validation on Node 20.20.2: lint/build/package exports, typecheck, 48 unit tests, and 27 integration tests passed.
patch-packagewas supplied through a temporary npm exec environment for the integration runner; package dependencies and the lockfile are unchanged.Summary by Sourcery
Add configurable response-size calculation for successful unary gRPC responses to avoid unnecessary processing when size statistics are not needed.
New Features:
calculateResponseSizesetting for successful unary gRPC actions, defaulting to enabled and supporting both proto-based and reflection-based actions.Enhancements:
sendStatsand reportingresponseSize: 0when disabled.Documentation:
Tests:
object-sizeofis not called when disabled.