use of io.jaegertracing.internal.exceptions.SenderException 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();
}
use of io.jaegertracing.internal.exceptions.SenderException in project jaeger-client-java by jaegertracing.
the class ThriftSenderTest method flushFail.
@Test(expected = SenderException.class)
public void flushFail() throws Exception {
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();
}
use of io.jaegertracing.internal.exceptions.SenderException in project jaeger-client-java by jaegertracing.
the class UdpSenderTest method testAppendSpanTooLarge.
@Test(expected = SenderException.class)
public void testAppendSpanTooLarge() 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 + 1);
try {
sender.append(jaegerSpan);
} catch (SenderException e) {
assertEquals(e.getDroppedSpanCount(), 1);
throw e;
}
}
use of io.jaegertracing.internal.exceptions.SenderException in project opentelemetry-java by open-telemetry.
the class JaegerThriftSpanExporter method export.
/**
* Submits all the given spans in a single batch to the Jaeger collector.
*
* @param spans the list of sampled Spans to be exported.
* @return the result of the operation
*/
@Override
public CompletableResultCode export(Collection<SpanData> spans) {
Map<Process, List<Span>> batches = spans.stream().collect(Collectors.groupingBy(SpanData::getResource)).entrySet().stream().collect(Collectors.toMap(entry -> createProcess(entry.getKey()), entry -> Adapter.toJaeger(entry.getValue())));
List<CompletableResultCode> batchResults = new ArrayList<>(batches.size());
batches.forEach((process, jaegerSpans) -> {
CompletableResultCode batchResult = new CompletableResultCode();
batchResults.add(batchResult);
try {
// todo: consider making truly async
thriftSender.send(process, jaegerSpans);
batchResult.succeed();
} catch (SenderException e) {
logger.log(Level.WARNING, "Failed to export spans", e);
batchResult.fail();
}
});
return CompletableResultCode.ofAll(batchResults);
}
use of io.jaegertracing.internal.exceptions.SenderException in project jaeger-client-java by jaegertracing.
the class ZipkinSenderTest method testAppendSpanTooLarge.
@Test
public void testAppendSpanTooLarge() {
JaegerSpan jaegerSpan = tracer.buildSpan("raza").start();
String msg = "";
for (int i = 0; i < 1001; i++) {
msg += ".";
}
jaegerSpan.log(msg);
try {
sender.append(jaegerSpan);
fail("The line above shoud throw");
} catch (SenderException e) {
assertEquals(e.getDroppedSpanCount(), 1);
}
}
Aggregations