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();
}
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();
}
Aggregations