-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[grpc-transcoding] Transcode unknown variable bindings #14710
Comments
Suggestion by @euroelessar that I also like: We can place this in However, variable bindings don't have much to do with the http body, and |
My feeling is such usage is very special, it requires special codes in the grpc_transcoder filter to handle it, it may de-stabilize the code which is used by many products. It will make the code too complicated that it is not easy to maintain. |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions. |
Hi @qiwzhang, From usage point of view, we have a use case where individual grpc endpoints can serve hundreds of individual paths using the same logic. The caveat is that this endpoint needs to know some additional metadata derived from the path segments. From complexity point of view, the proposed change of populating Another alternative would be to provide support of extensions for transcoding logic (e.g. allow users to write own extensions based on Any thoughts? |
@euroelessar @jhance I am still not fully understand the proposal. How about a draft pr to see how complex it is? |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions. |
… extension (#34999) Commit Message: [grpc-transcoder] Add option to pack unknown parameters into HttpBody extension Additional Description: We've been using this behavior for years, with PR #15338 as a patch. Finally getting around to trying to upstream the behavior to make it available for others, and to make it so I don't have to keep repositioning the patch. Unlike #15338 I'm also adding a configuration option so that no behavior change will occur without a corresponding configuration change. Risk Level: Very low, guarded by a new config field. Testing: Added positive unit tests, added conditions to other tests for the negative case. Docs Changes: Autogen Fixes #14710 --------- Signed-off-by: Raven Black <ravenblack@dropbox.com>
I have a use-case where I have a grpc server that is acting as a sort of proxy and needs to forward unknown variable bindings to its upstream. I plan to do the implementation but I would like to upstream this feature so that we don't have to carry forward an internal patch indefinitely and would like early feedback on the idea/implementation notes.
Currently variable bindings from path matching can only be transcoded if the request message contains them, e.g. a route for
/route/{path=**}
will need a message like this:I propose for unknown variable bindings, we recognize a special protobuf in the same way we recognize
HttpBody
:Where this particular message is defined as
Implementation wise, we can locate the
UnknownVariableBindings
at the same time we recognizeHttpBody
and store it inMethodInfoPtr
alongside there.To transcode the actual value, we will take advantage of the fact that an embedded message in protobuf is the same wire format as a string/bytes field. This means we can construct one additional
BindingInfo
here https://github.com/envoyproxy/envoy/blob/master/source/extensions/filters/http/grpc_json_transcoder/json_transcoder_filter.cc#L359 (by accumulating the list of unknown bindings in the loop above, and then creating theBindingInfo
later, by constructing the protobuf map, serializing it to bytes, and putting the serialized protobuf as thevalue
for theBindingInfo
. In this way we won't need any modifications to the upstream grpc transcoder library.We can either serialize the protobuf by hand in the above loop (to avoid copying) or assume that the amount of keys is rather small and construct then serialize at the end (for readability).
The text was updated successfully, but these errors were encountered: