Search in sources :

Example 1 with TChannel

use of com.uber.tchannel.api.TChannel in project java by wavefrontHQ.

the class PushAgent method startTraceJaegerListener.

protected void startTraceJaegerListener(String strPort, ReportableEntityHandlerFactory handlerFactory, @Nullable WavefrontSender wfSender, SpanSampler sampler) {
    if (tokenAuthenticator.authRequired()) {
        logger.warning("Port: " + strPort + " is not compatible with HTTP authentication, ignoring");
        return;
    }
    startAsManagedThread(Integer.parseInt(strPort), () -> {
        activeListeners.inc();
        try {
            TChannel server = new TChannel.Builder("jaeger-collector").setServerPort(Integer.parseInt(strPort)).build();
            server.makeSubChannel("jaeger-collector", Connection.Direction.IN).register("Collector::submitBatches", new JaegerTChannelCollectorHandler(strPort, handlerFactory, wfSender, () -> entityProps.get(ReportableEntityType.TRACE).isFeatureDisabled(), () -> entityProps.get(ReportableEntityType.TRACE_SPAN_LOGS).isFeatureDisabled(), preprocessors.get(strPort), sampler, proxyConfig.getTraceJaegerApplicationName(), proxyConfig.getTraceDerivedCustomTagKeys()));
            server.listen().channel().closeFuture().sync();
            server.shutdown(false);
        } catch (InterruptedException e) {
            logger.info("Listener on port " + strPort + " shut down.");
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Jaeger trace collector exception", e);
        } finally {
            activeListeners.dec();
        }
    }, "listener-jaeger-tchannel-" + strPort);
    logger.info("listening on port: " + strPort + " for trace data (Jaeger format over TChannel)");
}
Also used : JaegerTChannelCollectorHandler(com.wavefront.agent.listeners.tracing.JaegerTChannelCollectorHandler) NettyServerBuilder(io.grpc.netty.NettyServerBuilder) TokenAuthenticatorBuilder(com.wavefront.agent.auth.TokenAuthenticatorBuilder) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) CorsConfigBuilder(io.netty.handler.codec.http.cors.CorsConfigBuilder) TChannel(com.uber.tchannel.api.TChannel) ConfigurationException(com.wavefront.agent.config.ConfigurationException) BindException(java.net.BindException)

Aggregations

TChannel (com.uber.tchannel.api.TChannel)1 TokenAuthenticatorBuilder (com.wavefront.agent.auth.TokenAuthenticatorBuilder)1 ConfigurationException (com.wavefront.agent.config.ConfigurationException)1 JaegerTChannelCollectorHandler (com.wavefront.agent.listeners.tracing.JaegerTChannelCollectorHandler)1 NettyServerBuilder (io.grpc.netty.NettyServerBuilder)1 CorsConfigBuilder (io.netty.handler.codec.http.cors.CorsConfigBuilder)1 BindException (java.net.BindException)1 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)1