-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Implement gRPC Reflection Service #340
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, would be good to see how we could test this too.
fa3204a
to
e4c26eb
Compare
I've done some update work on this, including redirecting |
9f51521
to
83b2454
Compare
@jen20 sorry for the delay, what is the status on this? What are we blocked on? |
@LucioFranco No worries. To actually release this we're blocked on the |
any update here? |
Hi @kinosang, I'm still waiting for https://github.com/danburkert/prost/pull/326 to land to be able to make much progress in getting this merged here. |
This is still blocked by danburkert/prost#326 which itself is now blocked by danburkert/prost#397. |
@jen20 I believe that with danburkert/prost#409 (included w/ prost v0.7), this change is now possible 😄. Do you have the time to drive this? If not, I don't mind picking it up. |
This change updates jen20's work in hyperium#340 to work with the file descriptor set changes that landed in prost 0.7. * Updates branch with new changes from master * Updates server to use tokio 1.0 symantics * `tonic_build::Builder::include_file_descriptor_set` -> `file_descriptor_set_path`, which matchesprost.
This change updates jen20's work in hyperium#340 to work with the file descriptor set changes that landed in prost 0.7. * Updates branch with new changes from master * Updates server to use tokio 1.0 symantics * `tonic_build::Builder::include_file_descriptor_set` -> `file_descriptor_set_path`, which matchesprost. * The reflection server now returns UNIMPLEMENTED rather than NOT_FOUND when unsupported methods are called.
This commit adds a new option, `include_file_descriptor_set` to the tonic build configuration to in order to include the encoded protocol buffers `FileDescriptorSet` in `OUT_DIR`. It also adds a new macro `include_file_descriptor_set!`, to make it easy to include the well-known output path as a byte array in application source code. Co-authored-by: Samani G. Gikandi <[email protected]>
83b2454
to
ac8321c
Compare
Hi @sgg! I've rebased this PR and squashed the various changes into logical commits that can land on |
Thanks @ssg! Good news, after rebase etc, the original set of tests with the
This should be ready for review shortly. |
1a7cfb7
to
e0e4ed1
Compare
This commit adds an implementation, tests and example server for the `tonic-reflection` crate, which implements the server side of the GRPC Server Reflection Protocol. Co-authored-by: Samani G. Gikandi <[email protected]>
e0e4ed1
to
0ef55d1
Compare
I'm interested to see this make it in :) |
@@ -203,6 +205,13 @@ impl Builder { | |||
self | |||
} | |||
|
|||
/// Generate a file containing the encoded `prost_types::FileDescriptorSet` for protocol buffers | |||
/// modules. This is required for implementing gRPC Server Reflection. | |||
pub fn file_descriptor_set_path(mut self, path: impl AsRef<Path>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should just make this an option to add the descriptor to the generated proto file as a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LucioFranco Perhaps I'm misunderstanding this - wouldn't prost
need to support that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going through prost to generate this and it puts it into its own file then yes. I may have misunderstood.
Motivation
Issue #165 describes the motivations for the gRPC Reflection Service, along with the upstream definition.
Solution
This pull request implements a new crate,
tonic-reflection
which implements the gRPC Reflection Service and provides a builder for registering protocol bufferFileDescriptorProto
s. In the first instance, this relies on danburkert/prost#311, or a similar method, to embed encoded versions of the descriptor in code.This is an early work in progress, and only implements the
ListServices
andFileContainingSymbol
aspects of the reflection API, though this is enough to interrogate the shape of services and messages usinggrpcurl
. The new example server can be used withgrpcurl
to verify this:Currently the implementation is fairly rough - the following work is known as needed:
thiserror
when all variants are knownTo make this usable, we'll also likely depend on the upstreamprost
pull request being merged, and theprost-types
crate being generated with descriptor embedding enabled.CI will definitely fail, since it references locally modified crates in theCargo.toml
file for now - this PR is currently intended to make progress public for interested parties rather than being in a state to merge!