use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class ThriftSender method append.
@Override
public int append(JaegerSpan span) throws SenderException {
if (process == null) {
process = new Process(span.getTracer().getServiceName());
process.setTags(JaegerThriftSpanConverter.buildTags(span.getTracer().tags()));
processBytesSize = calculateProcessSize(process);
}
io.jaegertracing.thriftjava.Span thriftSpan = JaegerThriftSpanConverter.convertSpan(span);
int spanSize = calculateSpanSize(thriftSpan);
if (spanSize > getMaxSpanBytes()) {
throw new SenderException(String.format("ThriftSender received a span that was too large, size = %d, max = %d", spanSize, getMaxSpanBytes()), null, 1);
}
spanBytesSize += spanSize;
if (spanBytesSize <= getMaxSpanBytes()) {
spanBuffer.add(thriftSpan);
if (spanBytesSize < getMaxSpanBytes()) {
return 0;
}
return flush();
}
int n;
try {
n = flush();
} catch (SenderException e) {
// +1 for the span not submitted in the buffer above
throw new SenderException(e.getMessage(), e.getCause(), e.getDroppedSpanCount() + 1);
}
spanBuffer.add(thriftSpan);
spanBytesSize = spanSize;
return n;
}
use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class HttpSenderTest method sendServerError.
@Test(expected = Exception.class)
public void sendServerError() throws Exception {
HttpSender sender = new HttpSender.Builder(target("/api/tracesErr").getUri().toString()).build();
sender.send(new Process("robotrock"), generateSpans());
}
use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class HttpSenderTest method sendWithoutAuthData.
@Test
public void sendWithoutAuthData() throws Exception {
System.setProperty(Configuration.JAEGER_ENDPOINT, target("/api/traces").getUri().toString());
HttpSender sender = (HttpSender) Configuration.SenderConfiguration.fromEnv().getSender();
sender.send(new Process("robotrock"), generateSpans());
}
use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class HttpSenderTest method sendWithTokenAuth.
@Test
public void sendWithTokenAuth() throws Exception {
System.setProperty(Configuration.JAEGER_ENDPOINT, target("/api/bearer").getUri().toString());
System.setProperty(Configuration.JAEGER_AUTH_TOKEN, "thetoken");
HttpSender sender = (HttpSender) Configuration.SenderConfiguration.fromEnv().getSender();
sender.send(new Process("robotrock"), generateSpans());
}
use of io.jaegertracing.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class ThriftSenderTest method appendFail.
@Test(expected = SenderException.class)
public void appendFail() throws Exception {
int size = 0;
ThriftSender sender = new ThriftSender(ProtocolType.Compact, 0) {
@Override
public void send(Process process, List<Span> spans) throws SenderException {
throw new SenderException("", null, spans.size());
}
};
JaegerTracer tracer = new JaegerTracer.Builder("failure").build();
sender.append(tracer.buildSpan("flush-fail").start());
sender.flush();
}
Aggregations