use of com.uber.jaeger.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class ThriftSender method append.
@Override
public int append(Span span) throws SenderException {
if (process == null) {
process = new Process(span.getTracer().getServiceName());
process.setTags(JaegerThriftSpanConverter.buildTags(span.getTracer().tags()));
processBytesSize = getSizeOfSerializedThrift(process);
byteBufferSize += processBytesSize;
}
com.uber.jaeger.thriftjava.Span thriftSpan = JaegerThriftSpanConverter.convertSpan(span);
int spanSize = getSizeOfSerializedThrift(thriftSpan);
if (spanSize > maxSpanBytes) {
throw new SenderException(String.format("ThriftSender received a span that was too large, size = %d, max = %d", spanSize, maxSpanBytes), null, 1);
}
byteBufferSize += spanSize;
if (byteBufferSize <= maxSpanBytes) {
spanBuffer.add(thriftSpan);
if (byteBufferSize < maxSpanBytes) {
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);
byteBufferSize = processBytesSize + spanSize;
return n;
}
use of com.uber.jaeger.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class HttpSenderTest method serverDoesntExist.
@Test(expected = TException.class)
public void serverDoesntExist() throws Exception {
HttpSender sender = new HttpSender("http://some-server/api/traces");
sender.send(new Process("robotrock"), generateSpans());
}
use of com.uber.jaeger.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 com.uber.jaeger.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class HttpSenderTest method sendHappy.
@Test
public void sendHappy() throws Exception {
new HttpSender(target("/api/traces").getUri().toString()).send(new Process("robotrock"), generateSpans());
new HttpSender(target("/api/traces").getUri().toString(), 6500).send(new Process("name"), generateSpans());
new HttpSender(target("/api/traces").getUri().toString(), 6500, new OkHttpClient()).send(new Process("name"), generateSpans());
}
use of com.uber.jaeger.thriftjava.Process in project jaeger-client-java by jaegertracing.
the class HttpSenderTest method sendWithBasicAuth.
@Test
public void sendWithBasicAuth() throws Exception {
System.setProperty(Configuration.JAEGER_ENDPOINT, target("/api/basic-auth").getUri().toString());
System.setProperty(Configuration.JAEGER_USER, "jdoe");
System.setProperty(Configuration.JAEGER_PASSWORD, "password");
HttpSender sender = (HttpSender) Configuration.SenderConfiguration.fromEnv().getSender();
sender.send(new Process("robotrock"), generateSpans());
}
Aggregations