public function initTrace($serverName, $agentHostPort = ''){

        if(self::$disabled){
            return NoopTracer::create();
        }

        if($serverName == ''){
            throw new \Exception("serverName require");
        }

        if(isset(self::$tracer[$serverName]) && !empty(self::$tracer[$serverName])){
            return self::$tracer[$serverName];
        }


        if($this->transport == null){
            $this->transport = new TransportUdp($agentHostPort);
        }

        if($this->reporter == null) {
            $this->reporter = new RemoteReporter($this->transport);
        }

        if($this->sampler == null){
            $this->sampler = new ConstSampler(true);
        }


        $tracer = new Jaeger($serverName, $this->reporter, $this->sampler);

        if($this->gen128bit == true){
            $tracer->gen128bit();
        }

        if(self::$propagator == \Jaeger\Constants\PROPAGATOR_ZIPKIN){
            $tracer->setPropagator(new ZipkinPropagator());
        }else{
            $tracer->setPropagator(new JaegerPropagator());
        }


        self::$tracer[$serverName] = $tracer;


        return $tracer;
    }
public function initTrace($serverName, $agentHostPort = ''){

        if(self::$disabled){
            return NoopTracer::create();
        }

        if($serverName == ''){
            throw new \Exception("serverName require");
        }

        if(isset(self::$tracer[$serverName]) && !empty(self::$tracer[$serverName])){
            return self::$tracer[$serverName];
        }


        if($this->transport == null){
            $this->transport = new TransportUdp($agentHostPort);
        }

        if($this->reporter == null) {
            $this->reporter = new RemoteReporter($this->transport);
        }

        if($this->sampler == null){
            $this->sampler = new ConstSampler(true);
        }


        $tracer = new Jaeger($serverName, $this->reporter, $this->sampler);

        if($this->gen128bit == true){
            $tracer->gen128bit();
        }

        if(self::$propagator == \Jaeger\Constants\PROPAGATOR_ZIPKIN){
            $tracer->setPropagator(new ZipkinPropagator());
        }else{
            $tracer->setPropagator(new JaegerPropagator());
        }


        self::$tracer[$serverName] = $tracer;


        return $tracer;
    }
public function initTrace ( $ serverName , $ agentHostPort = '' ) { if ( self :: $ disabled ) { return NoopTracer :: create ( ) ; } if ( $ serverName == '' ) { throw new \ Exception ( "serverName require" ) ; } if ( isset ( self :: $ tracer [ $ serverName ] ) && ! empty ( self :: $ tracer [ $ serverName ] ) ) { return self :: $ tracer [ $ serverName ] ; } if ( $ this -> transport == null ) { $ this -> transport = new TransportUdp ( $ agentHostPort ) ; } if ( $ this -> reporter == null ) { $ this -> reporter = new RemoteReporter ( $ this -> transport ) ; } if ( $ this -> sampler == null ) { $ this -> sampler = new ConstSampler ( true ) ; } $ tracer = new Jaeger ( $ serverName , $ this -> reporter , $ this -> sampler ) ; if ( $ this -> gen128bit == true ) { $ tracer -> gen128bit ( ) ; } if ( self :: $ propagator == \ Jaeger \ Constants \ PROPAGATOR_ZIPKIN ) { $ tracer -> setPropagator ( new ZipkinPropagator ( ) ) ; } else { $ tracer -> setPropagator ( new JaegerPropagator ( ) ) ; } self :: $ tracer [ $ serverName ] = $ tracer ; return $ tracer ; }
init jaeger and set GlobalTracer, return can use flush  buffers
@param $serviceName
@param string $agentHostPort
@return Jaeger|null
@throws \Exception
init jaeger and set GlobalTracer return can use flush buffers