Search in sources :

Example 16 with Process

use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.

the class HttpSenderTest method sanityTestForTokenAuthTest.

@Test
public void sanityTestForTokenAuthTest() throws Exception {
    System.setProperty(Configuration.JAEGER_ENDPOINT, target("/api/bearer").getUri().toString());
    System.setProperty(Configuration.JAEGER_AUTH_TOKEN, "invalid-token");
    HttpSender sender = (HttpSender) Configuration.SenderConfiguration.fromEnv().getSender();
    try {
        sender.send(new Process("robotrock"), generateSpans());
        fail("expecting exception");
    } catch (Exception te) {
        assertTrue(te.getMessage().contains("response 401"));
    }
}
Also used : Process(io.jaegertracing.thriftjava.Process) SenderException(io.jaegertracing.internal.exceptions.SenderException) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Example 17 with Process

use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.

the class HttpSenderTest method sendHappy.

@Test
public void sendHappy() throws Exception {
    new HttpSender.Builder(target("/api/traces").getUri().toString()).build().send(new Process("robotrock"), generateSpans());
    new HttpSender.Builder(target("/api/traces").getUri().toString()).withMaxPacketSize(6500).build().send(new Process("name"), generateSpans());
    new HttpSender.Builder(target("/api/traces").getUri().toString()).withMaxPacketSize(6500).withClient(new OkHttpClient()).build().send(new Process("name"), generateSpans());
}
Also used : OkHttpClient(okhttp3.OkHttpClient) Process(io.jaegertracing.thriftjava.Process) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Example 18 with Process

use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.

the class HttpSenderTest method serverDoesntExist.

@Test(expected = Exception.class)
public void serverDoesntExist() throws Exception {
    HttpSender sender = new HttpSender.Builder("http://some-server/api/traces").build();
    sender.send(new Process("robotrock"), generateSpans());
}
Also used : Process(io.jaegertracing.thriftjava.Process) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest)

Example 19 with Process

use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.

the class UdpSenderTest method testAppendMaxSize.

@Test
public void testAppendMaxSize() throws Exception {
    Process process = new Process(tracer.getServiceName()).setTags(JaegerThriftSpanConverter.buildTags(tracer.tags()));
    int processSize = sender.getSize(process);
    JaegerSpan jaegerSpan = buildSpanWithSize(maxPacketSize - UdpSender.EMIT_BATCH_OVERHEAD - processSize);
    int result = sender.append(jaegerSpan);
    assertEquals(1, result);
    // test if the buffer is reinitialized correctly
    result = sender.append(jaegerSpan);
    assertEquals(1, result);
}
Also used : JaegerSpan(io.jaegertracing.internal.JaegerSpan) Process(io.jaegertracing.thriftjava.Process) Test(org.junit.Test)

Example 20 with Process

use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.

the class UdpSenderTest method testAppend.

@Test
public void testAppend() throws Exception {
    // find size of the initial span
    JaegerSpan jaegerSpan = tracer.buildSpan("raza").start();
    io.jaegertracing.thriftjava.Span span = JaegerThriftSpanConverter.convertSpan(jaegerSpan);
    Process process = new Process(tracer.getServiceName()).setTags(JaegerThriftSpanConverter.buildTags(tracer.tags()));
    int processSize = sender.getSize(process);
    int spanSize = sender.getSize(span);
    // create a sender thats a multiple of the span size (accounting for span overhead)
    // this allows us to test the boundary conditions of writing spans.
    int expectedNumSpans = 11;
    int maxPacketSize = (spanSize * expectedNumSpans) + UdpSender.EMIT_BATCH_OVERHEAD + processSize;
    int maxPacketSizeLeft = maxPacketSize - UdpSender.EMIT_BATCH_OVERHEAD - processSize;
    // add enough spans to be under buffer limit
    sender = new UdpSender(destHost, destPort, maxPacketSize);
    while (spanSize < maxPacketSizeLeft) {
        sender.append(jaegerSpan);
        maxPacketSizeLeft -= spanSize;
    }
    // add a span that overflows the limit to hit the last branch
    int result = sender.append(jaegerSpan);
    assertEquals(expectedNumSpans, result);
}
Also used : JaegerSpan(io.jaegertracing.internal.JaegerSpan) Process(io.jaegertracing.thriftjava.Process) Test(org.junit.Test)

Aggregations

Process (io.jaegertracing.thriftjava.Process)25 Test (org.junit.Test)23 SpanSampler (com.wavefront.agent.sampler.SpanSampler)11 Batch (io.jaegertracing.thriftjava.Batch)11 Annotation (wavefront.report.Annotation)11 Span (wavefront.report.Span)11 Tag (io.jaegertracing.thriftjava.Tag)10 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)9 Collector (io.jaegertracing.thriftjava.Collector)9 JerseyTest (org.glassfish.jersey.test.JerseyTest)7 SenderException (io.jaegertracing.internal.exceptions.SenderException)5 Log (io.jaegertracing.thriftjava.Log)4 SpanLog (wavefront.report.SpanLog)4 JaegerSpan (io.jaegertracing.internal.JaegerSpan)3 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)2 DurationSampler (com.wavefront.sdk.entities.tracing.sampling.DurationSampler)2 JaegerTracer (io.jaegertracing.internal.JaegerTracer)2 ByteBuf (io.netty.buffer.ByteBuf)2 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)2 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)2