src/python/grpcio_csds/grpc_csds/__init__.py
Go to the documentation of this file.
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 """Channelz debug service implementation in gRPC Python."""
15 
16 from envoy.service.status.v3 import csds_pb2
17 from envoy.service.status.v3 import csds_pb2_grpc
18 from google.protobuf import json_format
19 from grpc._cython import cygrpc
20 
21 
23  csds_pb2_grpc.ClientStatusDiscoveryServiceServicer):
24  """CSDS Servicer works for both the sync API and asyncio API."""
25 
26  @staticmethod
27  def FetchClientStatus(request, unused_context):
28  client_config = csds_pb2.ClientConfig.FromString(
29  cygrpc.dump_xds_configs())
30  response = csds_pb2.ClientStatusResponse()
31  response.config.append(client_config)
32  return response
33 
34  @staticmethod
35  def StreamClientStatus(request_iterator, context):
36  for request in request_iterator:
37  yield ClientStatusDiscoveryServiceServicer.FetchClientStatus(
38  request, context)
39 
40 
41 def add_csds_servicer(server):
42  """Register CSDS servicer to a server.
43 
44  CSDS is part of xDS protocol used to expose in-effective traffic
45  configuration (or xDS resources). It focuses on simplify the debugging of
46  unexpected routing behaviors, which could be due to a misconfiguration,
47  unhealthy backends or issues in the control or data plane.
48 
49  Args:
50  server: A gRPC server to which the CSDS service will be added.
51  """
52  csds_pb2_grpc.add_ClientStatusDiscoveryServiceServicer_to_server(
54 
55 
56 __all__ = ['ClientStatusDiscoveryServiceServicer', 'add_csds_servicer']
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
grpc_csds.ClientStatusDiscoveryServiceServicer
Definition: src/python/grpcio_csds/grpc_csds/__init__.py:23
grpc_csds.ClientStatusDiscoveryServiceServicer.StreamClientStatus
def StreamClientStatus(request_iterator, context)
Definition: src/python/grpcio_csds/grpc_csds/__init__.py:35
grpc._cython
Definition: src/python/grpcio/grpc/_cython/__init__.py:1
grpc_csds.ClientStatusDiscoveryServiceServicer.FetchClientStatus
def FetchClientStatus(request, unused_context)
Definition: src/python/grpcio_csds/grpc_csds/__init__.py:27
grpc_csds.add_csds_servicer
def add_csds_servicer(server)
Definition: src/python/grpcio_csds/grpc_csds/__init__.py:41


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:38