use of brave.propagation.TraceContext in project brave by openzipkin.
the class ITJms_1_1_TracingMessageProducer method should_prefer_current_to_stale_b3_header.
@Test
public void should_prefer_current_to_stale_b3_header() throws JMSException {
jms.setReadOnlyProperties(message, false);
setStringProperty(message, "b3", writeB3SingleFormat(newTraceContext(SamplingFlags.NOT_SAMPLED)));
TraceContext parent = newTraceContext(SamplingFlags.SAMPLED);
try (Scope scope = currentTraceContext.newScope(parent)) {
messageProducer.send(jms.destination, message);
}
Message received = messageConsumer.receive();
MutableSpan producerSpan = testSpanHandler.takeRemoteSpan(PRODUCER);
assertChildOf(producerSpan, parent);
assertThat(propertiesToMap(received)).containsAllEntriesOf(existingProperties).containsEntry("b3", producerSpan.traceId() + "-" + producerSpan.id() + "-1");
}
use of brave.propagation.TraceContext in project brave by openzipkin.
the class ITTracingJMSProducer method should_not_serialize_parent_span_id.
@Test
public void should_not_serialize_parent_span_id() {
TraceContext parent = newTraceContext(SamplingFlags.SAMPLED);
try (Scope scope = currentTraceContext.newScope(parent)) {
producer.send(jms.queue, "foo");
}
Message received = consumer.receive();
MutableSpan producerSpan = testSpanHandler.takeRemoteSpan(PRODUCER);
assertChildOf(producerSpan, parent);
assertThat(propertiesToMap(received)).containsAllEntriesOf(existingProperties).containsEntry("b3", producerSpan.traceId() + "-" + producerSpan.id() + "-1");
}
use of brave.propagation.TraceContext in project brave by openzipkin.
the class JmsTracingTest method nextSpan_prefers_b3_header.
@Test
public void nextSpan_prefers_b3_header() {
TraceContext incoming = newTraceContext(SamplingFlags.NOT_SAMPLED);
setStringProperty(message, "b3", B3SingleFormat.writeB3SingleFormat(incoming));
Span child;
try (Scope ws = tracing.currentTraceContext().newScope(parent)) {
child = jmsTracing.nextSpan(message);
}
assertChildOf(child.context(), incoming);
assertThat(child.isNoop()).isTrue();
}
use of brave.propagation.TraceContext in project brave by openzipkin.
the class ITJms_1_1_TracingMessageConsumer method resetB3PropertyWithNewSampledContext.
TraceContext resetB3PropertyWithNewSampledContext(JmsTestRule jms) throws JMSException {
TraceContext parent = newTraceContext(SamplingFlags.SAMPLED);
message = jms.newMessage("foo");
bytesMessage = jms.newBytesMessage("foo");
String b3 = B3SingleFormat.writeB3SingleFormatWithoutParentId(parent);
setStringProperty(message, "b3", b3);
setStringProperty(bytesMessage, "b3", b3);
lockMessages();
return parent;
}
use of brave.propagation.TraceContext in project brave by openzipkin.
the class ITJms_1_1_TracingMessageConsumer method receive_resumesTrace.
void receive_resumesTrace(JMSRunnable send, MessageConsumer messageConsumer) throws JMSException {
TraceContext parent = resetB3PropertyWithNewSampledContext(jms);
send.run();
Message received = messageConsumer.receive();
MutableSpan consumerSpan = testSpanHandler.takeRemoteSpan(CONSUMER);
assertChildOf(consumerSpan, parent);
assertThat(received.getStringProperty("b3")).isEqualTo(parent.traceIdString() + "-" + consumerSpan.id() + "-1");
}
Aggregations