Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c6e90761
Commit
c6e90761
authored
8 years ago
by
Yuchen Zeng
Browse files
Options
Downloads
Patches
Plain Diff
Address review comments
parent
8eaa1840
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/server_reflection_tutorial.md
+15
-16
15 additions, 16 deletions
doc/server_reflection_tutorial.md
with
15 additions
and
16 deletions
doc/server_reflection_tutorial.md
+
15
−
16
View file @
c6e90761
...
@@ -2,29 +2,28 @@
...
@@ -2,29 +2,28 @@
gRPC Server Reflection provides information about publicly-accessible gRPC
gRPC Server Reflection provides information about publicly-accessible gRPC
services on a server, and assists clients in runtime to construct RPC
services on a server, and assists clients in runtime to construct RPC
requests
/
responses without precompiled service information. It has been
requests
and
responses without precompiled service information. It has been
supported by gRPC CLI, which c
ould
be used to introspect server protos and
supported by gRPC CLI, which c
an
be used to introspect server protos and
send/receive test RPCs.
send/receive test RPCs.
## E
a
nble Server Reflection
## En
a
ble Server Reflection
### Enable server reflection in C++ servers
### Enable server reflection in C++ servers
C++ Server Reflection is offered as an add-on library,
`libgrpc++_reflction`
.
C++ Server Reflection is an add-on library,
`libgrpc++_reflction`
. To enable C++
To enable C++ server reflection, you can simply link this library to your server
server reflection, you can link this library to your server binary.
binary.
Some platforms (e.g. Ubuntu 11.10 onwards) only link in libraries that directly
Some platforms (e.g. Ubuntu 11.10 onwards) only link in libraries that directly
contain symbols used by the application. On these platforms, LD flag
contain symbols used by the application. On these platforms, LD flag
`--no-as-needed`
is needed for for dynamic linking and
`--whole-archive`
is
`--no-as-needed`
is needed for for dynamic linking and
`--whole-archive`
is
needed for for static linking.
needed for for static linking.
Here is an
[
examp
le
](
examples/cpp/helloworld/Makefile#L37#L45
)
for
enabling
c++
This
[
Makefi
le
](
examples/cpp/helloworld/Makefile#L37#L45
)
demonstrates
enabling
server reflection on Linux and MacOS.
c++
server reflection on Linux and MacOS.
## Test services using Server Reflection
## Test services using Server Reflection
gRPC Server Reflection
has been
supported by gRPC CLI. After enabling Server
gRPC Server Reflection
is
supported by gRPC CLI. After enabling Server
Reflection in a server application, you can use gRPC CLI to test its services.
Reflection in a server application, you can use gRPC CLI to test its services.
Instructions on how to use gRPC CLI can be found at
Instructions on how to use gRPC CLI can be found at
...
@@ -54,7 +53,7 @@ example server with Server Reflection enabled.
...
@@ -54,7 +53,7 @@ example server with Server Reflection enabled.
### List services
### List services
`grpc_cli ls`
command
can
list services and methods exposed at a given port
`grpc_cli ls`
command list
s
services and methods exposed at a given port
-
List all the services exposed at a given port
-
List all the services exposed at a given port
...
@@ -70,10 +69,10 @@ example server with Server Reflection enabled.
...
@@ -70,10 +69,10 @@ example server with Server Reflection enabled.
-
List one service with details
-
List one service with details
`grpc_cli ls`
command
can
inspect
one
service given its full name (in the
`grpc_cli ls`
command inspect
s a
service given its full name (in the
format of
format of
\<
package
\>
.
\<
service
\>
). It can print information with a long
\<
package
\>
.
\<
service
\>
). It can print information with a long
listing format
listing format
when
`-l`
flag is set. This flag can be used to get more
when
`-l`
flag is set. This flag can be used to get more
details about a
details about a
service.
service.
```
sh
```
sh
$
bins/opt/grpc_cli
ls
localhost:50051 helloworld.Greeter
-l
$
bins/opt/grpc_cli
ls
localhost:50051 helloworld.Greeter
-l
...
@@ -93,7 +92,7 @@ example server with Server Reflection enabled.
...
@@ -93,7 +92,7 @@ example server with Server Reflection enabled.
-
List one method with details
-
List one method with details
`grpc_cli ls`
command
can
also inspect
one
method given its full name (in the
`grpc_cli ls`
command also inspect
s a
method given its full name (in the
format of
\<
package
\>
.
\<
service
\>
.
\<
method
\>
).
format of
\<
package
\>
.
\<
service
\>
.
\<
method
\>
).
```
sh
```
sh
...
@@ -141,7 +140,7 @@ We can send RPCs to a server and get responses using `grpc_cli call` command.
...
@@ -141,7 +140,7 @@ We can send RPCs to a server and get responses using `grpc_cli call` command.
## Use Server Reflection in a C++ client
## Use Server Reflection in a C++ client
Server Reflection can be used by clients to get information about gRPC services
Server Reflection can be used by clients to get information about gRPC services
in
runtime. We've provided a descriptor database called
at
runtime. We've provided a descriptor database called
[
grpc::ProtoReflectionDescriptorDatabase
](
test/cpp/util/proto_reflection_descriptor_database.h
)
[
grpc::ProtoReflectionDescriptorDatabase
](
test/cpp/util/proto_reflection_descriptor_database.h
)
which implements the
which implements the
[
google::protobuf::DescriptorDatabase
](
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.descriptor_database#DescriptorDatabase
)
[
google::protobuf::DescriptorDatabase
](
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.descriptor_database#DescriptorDatabase
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment