| 1 |
# Copyright 2021 The gRPC Authors |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
"""gRPC Python's Admin interface.""" |
| 15 |
|
| 16 |
from grpc_channelz.v1 import channelz |
| 17 |
import grpc_csds |
| 18 |
|
| 19 |
|
| 20 |
def add_admin_servicers(server): |
| 21 |
"""Register admin servicers to a server. |
| 22 |
|
| 23 |
gRPC provides some predefined admin services to make debugging easier by |
| 24 |
exposing gRPC's internal states. Each existing admin service is packaged as |
| 25 |
a separate library, and the documentation of the predefined admin services |
| 26 |
is usually scattered. It can be time consuming to get the dependency |
| 27 |
management, module initialization, and library import right for each one of |
| 28 |
them. |
| 29 |
|
| 30 |
This API provides a convenient way to create a gRPC server to expose admin |
| 31 |
services. With this, any new admin services that you may add in the future |
| 32 |
are automatically available via the admin interface just by upgrading your |
| 33 |
gRPC version. |
| 34 |
|
| 35 |
Args: |
| 36 |
server: A gRPC server to which all admin services will be added. |
| 37 |
""" |
| 38 |
channelz.add_channelz_servicer(server) |
| 39 |
grpc_csds.add_csds_servicer(server) |
| 40 |
|
| 41 |
|
| 42 |
__all__ = ['add_admin_servicers'] |