def __init__( self, service_name, host_name=None, endpoint=None, client=None, transport=sync.SyncTransport): self.transport = transport(self) self.endpoint = DEFAULT_ENDPOINT if endpoint is None else endpoint if client is None: self.channel = grpc.insecure_channel(self.endpoint) self.client = trace_service_pb2_grpc.TraceServiceStub( channel=self.channel) else: self.client = client self.service_name = service_name self.node = common_pb2.Node( identifier=common_pb2.ProcessIdentifier( host_name=socket.gethostname() if host_name is None else host_name, pid=os.getpid(), start_timestamp=utils.proto_ts_from_datetime( datetime.datetime.utcnow()) ), library_info=common_pb2.LibraryInfo( language=common_pb2.LibraryInfo.Language.Value('PYTHON'), exporter_version=EXPORTER_VERSION, core_library_version=__version__ ), service_info=common_pb2.ServiceInfo(name=self.service_name))
def __init__( self, endpoint=DEFAULT_ENDPOINT, service_name=None, host_name=None, client=None, ): self.endpoint = endpoint if client is None: self.channel = grpc.insecure_channel(self.endpoint) self.client = trace_service_pb2_grpc.TraceServiceStub( channel=self.channel) else: self.client = client self.node = utils.get_node(service_name, host_name)
def __init__(self, service_name, host_name=None, endpoint=None, client=None, transport=sync.SyncTransport): self.transport = transport(self) self.endpoint = DEFAULT_ENDPOINT if endpoint is None else endpoint if client is None: self.channel = grpc.insecure_channel(self.endpoint) self.client = trace_service_pb2_grpc.TraceServiceStub( channel=self.channel) else: self.client = client self.service_name = service_name self.node = ocagent_utils.get_node(self.service_name, host_name)
def __init__( self, endpoint=DEFAULT_ENDPOINT, host_name=None, client=None, ): tracer_provider = trace.get_tracer_provider() service_name = (tracer_provider.resource.attributes[SERVICE_NAME] if getattr(tracer_provider, "resource", None) else Resource.create().attributes.get(SERVICE_NAME)) self.endpoint = endpoint if client is None: self.channel = grpc.insecure_channel(self.endpoint) self.client = trace_service_pb2_grpc.TraceServiceStub( channel=self.channel) else: self.client = client self.node = utils.get_node(service_name, host_name)