@@ -145,24 +145,26 @@ void roundtripsProduceFullAmqpTraceStructure() throws IOException {
145145 }
146146
147147 // The full distributed round-trip as one strict parent->child chain across both services and the
148- // broker. SORT_BY_ANCESTRY orders the spans parent->child (stable for a linear chain), and the 12
149- // count-exact positional matchers pin the shape: HTTP entrypoint -> publish -> receiver
150- // consumes+forwards -> sender consumes reply.
148+ // broker. SORT_BY_ANCESTRY orders the spans parent->child (stable for a linear chain), and each
149+ // matcher after the root pins its parent to the preceding span with childOfPrevious() — so the 12
150+ // count-exact positional matchers assert both the shape and the explicit parent linkage: HTTP
151+ // entrypoint -> publish -> receiver consumes+forwards -> sender consumes reply.
151152 private static TraceMatcher roundTrip () {
152153 return trace (
153154 SORT_BY_ANCESTRY ,
154155 sp ("spring-rabbit-0" , "servlet.request" , "GET /roundtrip/{message}" ).root (),
155- sp ("spring-rabbit-0" , "spring.handler" , "WebController.roundtrip" ),
156- sp ("spring-rabbit-0" , "amqp.command" , "basic.publish <default> -> otherqueue" ),
157- sp ("rabbitmq" , "amqp.deliver" , "amqp.deliver otherqueue" ),
158- sp ("spring-rabbit-1" , "amqp.command" , "basic.deliver otherqueue" ),
159- sp ("spring-rabbit-1" , "amqp.consume" , "amqp.consume otherqueue" ),
160- sp ("spring-rabbit-1" , "spring.consume" , "Receiver.receiveMessage" ),
161- sp ("spring-rabbit-1" , "amqp.command" , "basic.publish <default> -> queue" ),
162- sp ("rabbitmq" , "amqp.deliver" , "amqp.deliver queue" ),
163- sp ("spring-rabbit-0" , "amqp.command" , "basic.deliver queue" ),
164- sp ("spring-rabbit-0" , "amqp.consume" , "amqp.consume queue" ),
165- sp ("spring-rabbit-0" , "spring.consume" , "Receiver.receiveMessage" ));
156+ sp ("spring-rabbit-0" , "spring.handler" , "WebController.roundtrip" ).childOfPrevious (),
157+ sp ("spring-rabbit-0" , "amqp.command" , "basic.publish <default> -> otherqueue" )
158+ .childOfPrevious (),
159+ sp ("rabbitmq" , "amqp.deliver" , "amqp.deliver otherqueue" ).childOfPrevious (),
160+ sp ("spring-rabbit-1" , "amqp.command" , "basic.deliver otherqueue" ).childOfPrevious (),
161+ sp ("spring-rabbit-1" , "amqp.consume" , "amqp.consume otherqueue" ).childOfPrevious (),
162+ sp ("spring-rabbit-1" , "spring.consume" , "Receiver.receiveMessage" ).childOfPrevious (),
163+ sp ("spring-rabbit-1" , "amqp.command" , "basic.publish <default> -> queue" ).childOfPrevious (),
164+ sp ("rabbitmq" , "amqp.deliver" , "amqp.deliver queue" ).childOfPrevious (),
165+ sp ("spring-rabbit-0" , "amqp.command" , "basic.deliver queue" ).childOfPrevious (),
166+ sp ("spring-rabbit-0" , "amqp.consume" , "amqp.consume queue" ).childOfPrevious (),
167+ sp ("spring-rabbit-0" , "spring.consume" , "Receiver.receiveMessage" ).childOfPrevious ());
166168 }
167169
168170 // A connection-setup / ack command emitted as its own single-span (root) trace.
0 commit comments