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)
def _create_stub(endpoint): return metrics_service_pb2_grpc.MetricsServiceStub( grpc.insecure_channel(endpoint))
def _create_stub(self): return metrics_service_pb2_grpc.MetricsServiceStub( channel=self._channel)