1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2import grpc
3
4from opencensus.proto.agent.metrics.v1 import metrics_service_pb2 as opencensus_dot_proto_dot_agent_dot_metrics_dot_v1_dot_metrics__service__pb2
5
6
7class MetricsServiceStub(object):
8  """Service that can be used to push metrics between one Application
9  instrumented with OpenCensus and an agent, or between an agent and a
10  central collector.
11  """
12
13  def __init__(self, channel):
14    """Constructor.
15
16    Args:
17      channel: A grpc.Channel.
18    """
19    self.Export = channel.stream_stream(
20        '/opencensus.proto.agent.metrics.v1.MetricsService/Export',
21        request_serializer=opencensus_dot_proto_dot_agent_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceRequest.SerializeToString,
22        response_deserializer=opencensus_dot_proto_dot_agent_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceResponse.FromString,
23        )
24
25
26class MetricsServiceServicer(object):
27  """Service that can be used to push metrics between one Application
28  instrumented with OpenCensus and an agent, or between an agent and a
29  central collector.
30  """
31
32  def Export(self, request_iterator, context):
33    """For performance reasons, it is recommended to keep this RPC
34    alive for the entire life of the application.
35    """
36    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
37    context.set_details('Method not implemented!')
38    raise NotImplementedError('Method not implemented!')
39
40
41def add_MetricsServiceServicer_to_server(servicer, server):
42  rpc_method_handlers = {
43      'Export': grpc.stream_stream_rpc_method_handler(
44          servicer.Export,
45          request_deserializer=opencensus_dot_proto_dot_agent_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceRequest.FromString,
46          response_serializer=opencensus_dot_proto_dot_agent_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceResponse.SerializeToString,
47      ),
48  }
49  generic_handler = grpc.method_handlers_generic_handler(
50      'opencensus.proto.agent.metrics.v1.MetricsService', rpc_method_handlers)
51  server.add_generic_rpc_handlers((generic_handler,))
52