コード例 #1
0
    def __init__(
        self,
        endpoint: str = DEFAULT_ENDPOINT,
        service_name: str = None,
        host_name: str = None,
        client: metrics_service_pb2_grpc.MetricsServiceStub = None,
    ):
        self.endpoint = endpoint
        if client is None:
            channel = grpc.insecure_channel(self.endpoint)
            self.client = metrics_service_pb2_grpc.MetricsServiceStub(
                channel=channel)
        else:
            self.client = client

        self.node = utils.get_node(service_name, host_name)
コード例 #2
0
def _create_stub(endpoint):
    return metrics_service_pb2_grpc.MetricsServiceStub(
        grpc.insecure_channel(endpoint))
コード例 #3
0
 def _create_stub(self):
     return metrics_service_pb2_grpc.MetricsServiceStub(
         channel=self._channel)