Search in sources :

Example 1 with TChannelServer

use of com.uber.jaeger.crossdock.resources.behavior.tchannel.TChannelServer in project jaeger-client-java by jaegertracing.

the class JerseyServer method main.

public static void main(String[] args) throws Exception {
    BasicConfigurator.configure();
    String serviceName = serviceNameFromEnv();
    JerseyServer server = new JerseyServer("0.0.0.0:8081", serviceName, Arrays.asList(new TraceBehaviorResource(), new EndToEndBehaviorResource(new EndToEndBehavior(getEvn(SAMPLING_HOST_PORT, "jaeger-agent:5778"), "crossdock-" + serviceName, senderFromEnv(getEvn(COLLECTOR_HOST_PORT, "jaeger-collector:14268"), getEvn(AGENT_HOST, "jaeger-agent")))), new HealthResource()));
    server.addNetworkListener(new NetworkListener("health", "0.0.0.0", 8080));
    Builder tchannelBuilder = new Builder(serviceName);
    tchannelBuilder.setServerPort(8082);
    new TChannelServer(tchannelBuilder, new TraceBehavior(), server.getTracer()).start();
}
Also used : EndToEndBehavior(com.uber.jaeger.crossdock.resources.behavior.EndToEndBehavior) TraceBehavior(com.uber.jaeger.crossdock.resources.behavior.TraceBehavior) TraceBehaviorResource(com.uber.jaeger.crossdock.resources.behavior.http.TraceBehaviorResource) Builder(com.uber.tchannel.api.TChannel.Builder) ClientBuilder(javax.ws.rs.client.ClientBuilder) EndToEndBehaviorResource(com.uber.jaeger.crossdock.resources.behavior.http.EndToEndBehaviorResource) TChannelServer(com.uber.jaeger.crossdock.resources.behavior.tchannel.TChannelServer) HealthResource(com.uber.jaeger.crossdock.resources.health.HealthResource) NetworkListener(org.glassfish.grizzly.http.server.NetworkListener)

Example 2 with TChannelServer

use of com.uber.jaeger.crossdock.resources.behavior.tchannel.TChannelServer in project jaeger-client-java by jaegertracing.

the class TraceBehaviorResourceTest method testJoinTraceTChannel.

@Test
public void testJoinTraceTChannel() throws Exception {
    Builder tchannelBuilder = new Builder("foo");
    tchannelBuilder.setServerPort(0);
    tchannelBuilder.setServerHost(InetAddress.getLoopbackAddress());
    TChannelServer tchannel = new TChannelServer(tchannelBuilder, behavior, server.getTracer());
    tchannel.start();
    Span span = (Span) server.getTracer().buildSpan("root").startManual();
    TracingUtils.getTraceContext().push(span);
    String expectedBaggage = "baggage-example";
    span.setBaggageItem(Constants.BAGGAGE_KEY, expectedBaggage);
    if (expectedSampled) {
        Tags.SAMPLING_PRIORITY.set(span, 1);
    }
    TraceResponse response = behavior.callDownstreamTChannel(new Downstream(SERVICE_NAME, tchannel.getChannel().getListeningHost(), String.valueOf(tchannel.getChannel().getListeningPort()), Constants.TRANSPORT_TCHANNEL, "s2", new Downstream(SERVICE_NAME, tchannel.getChannel().getListeningHost(), String.valueOf(tchannel.getChannel().getListeningPort()), Constants.TRANSPORT_TCHANNEL, "s3", null)));
    assertNotNull(response);
    validateTraceResponse(response, String.format("%x", span.context().getTraceId()), expectedBaggage, 1);
    tchannel.shutdown();
}
Also used : Builder(com.uber.tchannel.api.TChannel.Builder) TChannelServer(com.uber.jaeger.crossdock.resources.behavior.tchannel.TChannelServer) Span(com.uber.jaeger.Span) ObservedSpan(com.uber.jaeger.crossdock.api.ObservedSpan) Downstream(com.uber.jaeger.crossdock.api.Downstream) TraceResponse(com.uber.jaeger.crossdock.api.TraceResponse) Test(org.junit.Test)

Aggregations

TChannelServer (com.uber.jaeger.crossdock.resources.behavior.tchannel.TChannelServer)2 Builder (com.uber.tchannel.api.TChannel.Builder)2 Span (com.uber.jaeger.Span)1 Downstream (com.uber.jaeger.crossdock.api.Downstream)1 ObservedSpan (com.uber.jaeger.crossdock.api.ObservedSpan)1 TraceResponse (com.uber.jaeger.crossdock.api.TraceResponse)1 EndToEndBehavior (com.uber.jaeger.crossdock.resources.behavior.EndToEndBehavior)1 TraceBehavior (com.uber.jaeger.crossdock.resources.behavior.TraceBehavior)1 EndToEndBehaviorResource (com.uber.jaeger.crossdock.resources.behavior.http.EndToEndBehaviorResource)1 TraceBehaviorResource (com.uber.jaeger.crossdock.resources.behavior.http.TraceBehaviorResource)1 HealthResource (com.uber.jaeger.crossdock.resources.health.HealthResource)1 ClientBuilder (javax.ws.rs.client.ClientBuilder)1 NetworkListener (org.glassfish.grizzly.http.server.NetworkListener)1 Test (org.junit.Test)1