Creates and starts a new tracer. If one already exists, this is a
no-op. Synchronized to prevent multiple threads enabling it at the same
time.
191275
private static synchronized void start() throws IOException {
        if (s_tracer == null) {
            final VoltTrace tracer = new VoltTrace();
            final Thread thread = new Thread(tracer);
            thread.setDaemon(true);
            thread.start();
            s_tracer = tracer;
        }
    }
288913
def trace_integration(tracer=None):
    """"""
    log.info("Integrated module: {}".format(MODULE_NAME))
    # Wrap the threading start function
    start_func = getattr(threading.Thread, "start")
    setattr(
        threading.Thread, start_func.__name__, wrap_threading_start(start_func)
    )

    # Wrap the threading run function
    run_func = getattr(threading.Thread, "run")
    setattr(threading.Thread, run_func.__name__, wrap_threading_run(run_func))

    # Wrap the threading run function
    apply_async_func = getattr(pool.Pool, "apply_async")
    setattr(
        pool.Pool,
        apply_async_func.__name__,
        wrap_apply_async(apply_async_func),
    )

    # Wrap the threading run function
    submit_func = getattr(futures.ThreadPoolExecutor, "submit")
    setattr(
        futures.ThreadPoolExecutor,
        submit_func.__name__,
        wrap_submit(submit_func),
    )
916632
public static void startTrack(final Object... args){
    if(isClosed){ return; }
    //--Create Record
    final int len = args.length == 0 ? 0 : args.length-1;
    final Object content = args.length == 0 ? "" : args[len];
    final Object[] tags = new Object[len];
    final StackTraceElement ste = getStackTrace();
    final long timestamp = System.currentTimeMillis();
    System.arraycopy(args,0,tags,0,len);
    //--Create Task
    final long threadID = Thread.currentThread().getId();
    final Runnable startTrack = new Runnable(){
      public void run(){
        assert !isThreaded || control.isHeldByCurrentThread();
        Record toPass = new Record(content,tags,depth,ste,timestamp);
        depth += 1;
        titleStack.push(args.length == 0 ? "" : args[len].toString());
        handlers.process(toPass, MessageType.START_TRACK, depth, toPass.timesstamp);
        assert !isThreaded || control.isHeldByCurrentThread();
      }
    };
    //--Run Task
    if(isThreaded){
      //(case: multithreaded)
      long threadId = Thread.currentThread().getId();
      attemptThreadControl( threadId, startTrack );
    } else {
      //(case: no threading)
      startTrack.run();
    }
  }
567805
public static TraceEvent beginAsync(String name, Object id, Object... args) {
        return new TraceEvent(TraceEventType.ASYNC_BEGIN, name, String.valueOf(id), args);
    }
1105103
private FragmentInstance createNewInstance() {
    try {
      return (FragmentInstance) getBackingClass().newInstance();
    } catch (InstantiationException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }
1125938
public void createControlAdapter()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createControlAdapter");

    // The type of control adapter created depends on the type of destination
    // that we're working with
    if(!destinationHandler.isLink())
    {
      XmitPoint rqm =
        (XmitPoint) destinationHandler.getRemoteQueuePointControl(getLocalizingMEUuid(), true);
      controlAdapter = new XmitPointControl(rqm,
                                            this,                                        
                                            destinationHandler); 
    }
    else
    { 
      // Use the StreamSet's Control Adapter for the "link remote queue points"
      controlAdapter = 
        new LinkRemoteQueuePoint(destinationHandler, this);
    }                                          
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createControlAdapter", controlAdapter);
  }
641900
public static void init() {
        String tracerClassName = System.getProperty(OPENTRACING_TRACER_CLASS_NAME);
        Preconditions.checkNotNull(tracerClassName, "Can not find opentracing tracer implementation class via system property `%s`", OPENTRACING_TRACER_CLASS_NAME);
        try {
            init((Tracer) Class.forName(tracerClassName).newInstance());
        } catch (final ReflectiveOperationException ex) {
            throw new ShardingException("Initialize opentracing tracer class failure.", ex);
        }
    }
295161
public void start() {
        stop();  // Make sure any currently running dispatchers are stopped.
        // Create the cache dispatcher and start it.


        if (cacheDispatcher == null) {
            cacheDispatcher = new CacheDispatcher(cacheQueue, networkQueue, cache, delivery);
        }
        cacheDispatcher.start();
        addMarker(EVENT_CACHE_DISPATCHER_START, cacheDispatcher);

        // Create network dispatchers (and corresponding threads) up to the pool size.
        setUpNetworkDispatchers();
    }
935499
private void createReaperAlarm() {
        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (pmQuiesced) {
            if (isTracingEnabled && tc.isDebugEnabled())
                Tr.debug(tc, " PM has been Quiesced, so cancel old reaper alarm.");
            if (am != null)
                am.cancel(false);
            return;
        }

        if (nonDeferredReaperAlarm) {
            if (isTracingEnabled && tc.isDebugEnabled())
                Tr.debug(this, tc, "Creating non-deferrable alarm for reaper");

            if (am != null) {
                // If an alarm thread already exists, cancel it and create a
                // new one with the latest reapTime
                am.cancel(false);
                if (am.isDone()) {
                    alarmThreadCounter.decrementAndGet();
                    if (isTracingEnabled && tc.isDebugEnabled())
                        Tr.debug(this, tc, "Previous alarm thread cancelled.");

                    alarmThreadCounter.incrementAndGet();
                    try {
                        am = connectorSvc.nonDeferrableSchedXSvcRef.getServiceWithException().schedule(this, reapTime, TimeUnit.SECONDS);
                    } catch (Exception e) {
                        alarmThreadCounter.decrementAndGet();
                        throw new RuntimeException(e);
                    }
                } // end am.isDone() == true
            } // end am != null
            else { // am == null
                if (isTracingEnabled && tc.isDebugEnabled())
                    Tr.debug(this, tc, "No previous alarm thread exists. Creating a new one.");

                alarmThreadCounter.incrementAndGet();
                try {
                    am = connectorSvc.nonDeferrableSchedXSvcRef.getServiceWithException().schedule(this, reapTime, TimeUnit.SECONDS);
                } catch (Exception e) {
                    alarmThreadCounter.decrementAndGet();
                    throw new RuntimeException(e);
                }
            } // am == null
        } // end nonDeferredReaperAlarm == true
        else { // nonDeferredReaperAlarm == false
            if (isTracingEnabled && tc.isDebugEnabled())
                Tr.debug(this, tc, "Creating deferrable alarm for reaper");

            if (am != null) {
                // If an alarm thread already exists, cancel it and create a
                // new one with the latest reapTime
                am.cancel(false);
                if (am.isDone()) {
                    alarmThreadCounter.decrementAndGet();
                    if (isTracingEnabled && tc.isDebugEnabled())
                        Tr.debug(this, tc, "Previous alarm thread cancelled.");

                    alarmThreadCounter.incrementAndGet();
                    try {
                        am = connectorSvc.deferrableSchedXSvcRef.getServiceWithException().schedule(this, reapTime, TimeUnit.SECONDS);
                    } catch (Exception e) {
                        alarmThreadCounter.decrementAndGet();
                        throw new RuntimeException(e);
                    }
                } // end am.isDone() == true
            } // end am != null
            else { // am == null
                if (isTracingEnabled && tc.isDebugEnabled())
                    Tr.debug(this, tc, "No previous alarm thread exists. Creating a new one.");

                alarmThreadCounter.incrementAndGet();
                try {
                    am = connectorSvc.deferrableSchedXSvcRef.getServiceWithException().schedule(this, reapTime, TimeUnit.SECONDS);
                } catch (Exception e) {
                    alarmThreadCounter.decrementAndGet();
                    throw new RuntimeException(e);
                }
            } // am == null
        } // end nonDeferredReaperAlarm == false
    }
687155
public void     start()
    {
        Preconditions.checkState(Thread.currentThread().equals(ourThread), "Not in the correct thread");

        client.addParentWatcher(watcher);
    }
936686
protected static <T> T getTracer(Class<T> intf, InterfaceTracer tracer, T ob)
    {
        tracer.setAppendable(System.err);
        tracer.setObj(ob);
        return (T) Proxy.newProxyInstance(
                intf.getClassLoader(), 
                new Class<?>[] {intf}, 
                tracer);
    }
51781
public static StatsTraceContext newClientContext(
      final CallOptions callOptions, final Attributes transportAttrs, Metadata headers) {
    List<ClientStreamTracer.Factory> factories = callOptions.getStreamTracerFactories();
    if (factories.isEmpty()) {
      return NOOP;
    }
    ClientStreamTracer.StreamInfo info =
        ClientStreamTracer.StreamInfo.newBuilder()
            .setTransportAttrs(transportAttrs).setCallOptions(callOptions).build();
    // This array will be iterated multiple times per RPC. Use primitive array instead of Collection
    // so that for-each doesn't create an Iterator every time.
    StreamTracer[] tracers = new StreamTracer[factories.size()];
    for (int i = 0; i < tracers.length; i++) {
      tracers[i] = factories.get(i).newClientStreamTracer(info, headers);
    }
    return new StatsTraceContext(tracers);
  }
449676
def new_tracer(self, io_loop=None):
        
        channel = self._create_local_agent_channel(io_loop=io_loop)
        sampler = self.sampler
        if not sampler:
            sampler = RemoteControlledSampler(
                channel=channel,
                service_name=self.service_name,
                logger=logger,
                metrics_factory=self._metrics_factory,
                error_reporter=self.error_reporter,
                sampling_refresh_interval=self.sampling_refresh_interval,
                max_operations=self.max_operations)
        logger.info('Using sampler %s', sampler)

        reporter = Reporter(
            channel=channel,
            queue_capacity=self.reporter_queue_size,
            batch_size=self.reporter_batch_size,
            flush_interval=self.reporter_flush_interval,
            logger=logger,
            metrics_factory=self._metrics_factory,
            error_reporter=self.error_reporter)

        if self.logging:
            reporter = CompositeReporter(reporter, LoggingReporter(logger))

        if not self.throttler_group() is None:
            throttler = RemoteThrottler(
                channel,
                self.service_name,
                refresh_interval=self.throttler_refresh_interval,
                logger=logger,
                metrics_factory=self._metrics_factory,
                error_reporter=self.error_reporter)
        else:
            throttler = None

        return self.create_tracer(
            reporter=reporter,
            sampler=sampler,
            throttler=throttler,
        )
363450
def default_create_thread(callback):
    
    thread = threading.Thread(None, callback)
    thread.daemon = True  # Don't let thread prevent termination
    thread.start()
    return thread
1353517
def wrap_create_channel(create_channel_func, tracer=None):
    """"""
    def call(*args, **kwargs):
        channel = create_channel_func(*args, **kwargs)

        try:
            target = kwargs.get('target')
            tracer_interceptor = OpenCensusClientInterceptor(tracer, target)
            intercepted_channel = grpc.intercept_channel(
                channel, tracer_interceptor)
            return intercepted_channel  # pragma: NO COVER
        except Exception:
            log.warning(
                'Failed to wrap create_channel, '
                'clientlibs grpc calls not traced.')
            return channel
    return call
846889
private Runnable createProcessRunner(final BlockingQueue<FlowletProcessEntry<?>> processQueue,
                                       final List<FlowletProcessEntry<?>> processList,
                                       final ClassLoader classLoader) {
    return new Runnable() {
      @Override
      public void run() {
        Thread.currentThread().setContextClassLoader(classLoader);
        for (FlowletProcessEntry<?> entry : processList) {
          if (!handleProcessEntry(entry, processQueue)) {
            processQueue.offer(entry);
          }
        }
      }
    };
  }
65853
private static void createRestorerInstance() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createRestorerInstance");
    try {
      Class cls = Class.forName(SI_MESSAGE_HANDLE_RESTORER_CLASS);
      instance = (SIMessageHandleRestorer) cls.newInstance();
    }
    catch (Exception e) {
      FFDCFilter.processException(e, "com.ibm.wsspi.sib.core.SIMessageHandleRestorer.createRestorerInstance", "100");
       SibTr.error(tc,"UNABLE_TO_CREATE_HANDLERESTORER_CWSIB0010",e);
      NoClassDefFoundError ncdfe = new NoClassDefFoundError(e.getMessage());
      ncdfe.initCause(e);
      throw ncdfe;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createRestorerInstance");
  }