Search in sources :

Example 1 with StartTraceRequest

use of com.uber.jaeger.crossdock.api.StartTraceRequest in project jaeger-client-java by jaegertracing.

the class TraceBehaviorResourceTest method testStartTraceHttp.

@Test
public void testStartTraceHttp() throws Exception {
    Span span = (Span) server.getTracer().buildSpan("root").start();
    TracingUtils.getTraceContext().push(span);
    String expectedTraceId = String.format("%x", span.context().getTraceId());
    String expectedBaggage = "baggage-example";
    Downstream downstream = new Downstream(SERVICE_NAME, "127.0.0.1", port, Constants.TRANSPORT_HTTP, "server", null);
    StartTraceRequest startTraceRequest = new StartTraceRequest("server-role", expectedSampled, expectedBaggage, downstream);
    Response resp = JerseyServer.client.target(String.format("http://%s/start_trace", hostPort)).request(MediaType.APPLICATION_JSON).post(Entity.json(startTraceRequest));
    TraceResponse traceResponse = resp.readEntity(TraceResponse.class);
    assertNotNull(traceResponse.getDownstream());
    validateTraceResponse(traceResponse, expectedTraceId, expectedBaggage, 1);
}
Also used : StartTraceRequest(com.uber.jaeger.crossdock.api.StartTraceRequest) TraceResponse(com.uber.jaeger.crossdock.api.TraceResponse) Response(javax.ws.rs.core.Response) 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

Span (com.uber.jaeger.Span)1 Downstream (com.uber.jaeger.crossdock.api.Downstream)1 ObservedSpan (com.uber.jaeger.crossdock.api.ObservedSpan)1 StartTraceRequest (com.uber.jaeger.crossdock.api.StartTraceRequest)1 TraceResponse (com.uber.jaeger.crossdock.api.TraceResponse)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1