public HttpClientTracingHandler newClientHandler() { if (!enabled()) { return null; } HttpClientTracingDispatch tracingDispatch = new HttpClientTracingDispatch(name, tracer); return new HttpClientTracingHandler(tracingDispatch); }
public HttpServerTracingHandler newServerHandler() { if (!enabled()) { return null; } HttpServerTracingDispatch state = new HttpServerTracingDispatch(name, tracer); return new HttpServerTracingHandler(state); }
public HttpServerTracingHandler(HttpServerTracingDispatch state) { super(buildInbound(state), buildOutbound(state)); } }
@Test public void testValidParametersConfig() { // This when the zipkinurl is non-empty AND the sampling rate is > 0.0f subject = new XioTracing(validParametersConfig); assertNotNull(subject.newClientHandler()); assertNotNull(subject.newServerHandler()); }
@Test public void testInvalidParametersConfig() { // This when the zipkinurl is empty OR the sampling rate is <= 0.0f subject = new XioTracing(invalidParametersConfig); assertNull(subject.newClientHandler()); assertNull(subject.newServerHandler()); } }
public ApplicationState(ApplicationConfig config) { this(config, new XioTracing(config.getTracingConfig())); }
@Before public void setup() throws Exception { httpTracing = HttpTracing.create(tracingBuilder(Sampler.ALWAYS_SAMPLE).build()); BraveTracer braveTracer = BraveTracer.create(httpTracing.tracing()); httpTracingState = new HttpServerTracingDispatch("test", braveTracer); }
public HttpClientTracingHandler(HttpClientTracingDispatch state) { super(buildInbound(state), buildOutbound(state)); } }
public ChannelHandler tracingHandler(ApplicationState appState) { if (appState.tracing() != null) { return appState.tracing().newServerHandler(); } else { return null; } } }
private static HttpServerResponseTracingHandler buildOutbound(HttpServerTracingDispatch state) { return new HttpServerResponseTracingHandler(state); }
private static HttpClientResponseTracingHandler buildInbound(HttpClientTracingDispatch state) { return new HttpClientResponseTracingHandler(state); }
private static HttpServerRequestTracingHandler buildInbound(HttpServerTracingDispatch state) { return new HttpServerRequestTracingHandler(state); }
private static HttpClientRequestTracingHandler buildOutbound(HttpClientTracingDispatch state) { return new HttpClientRequestTracingHandler(state); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { state.onError(ctx, cause); ctx.fireExceptionCaught(cause); } }
@Override public void channelRead0(ChannelHandlerContext ctx, Response response) throws Exception { if (response.endOfMessage()) { state.onResponse(ctx, response); } ctx.fireChannelRead(response); }
@Override public void channelRead0(ChannelHandlerContext ctx, Request request) throws Exception { if (request.startOfMessage()) { state.onRequest(ctx, request); } ctx.fireChannelRead(request); }
@BeforeClass public static void setupJul() { disableJavaLogging(); JulBridge.initialize(); }
@Override protected void channelRead0(ChannelHandlerContext ctx, Request msg) throws Exception { if (msg instanceof SegmentedRequestData && msg.endOfMessage()) { sendResponse(ctx, msg.httpTraceInfo(), msg.streamId()); return; } else if (msg instanceof FullRequest) { sendResponse(ctx, msg.httpTraceInfo(), msg.streamId()); } ctx.write(msg); }
public ApplicationBootstrap(ApplicationConfig config) { this(config, new ApplicationState(config, new XioTracing(config.getTracingConfig()))); }
@Override public XioTracing tracing() { if (tracing == null) { ApplicationConfig appConfig = ApplicationConfig.fromConfig("xio.edgeProxyApplication"); tracing = new XioTracing(appConfig.getTracingConfig()); } return tracing; }