@@ -870,39 +870,42 @@ private static SpanKind captureSpanKind(String rabbitCommand) {
870870 }
871871
872872 private static void verifyNetAttributes (SpanDataAssert span ) {
873- span .hasAttributesSatisfying (
874- attributes -> {
875- assertThat (attributes )
876- .satisfies (
877- attrs -> {
878- // Legacy convention keys (already imported statically)
879- String legacyPeerAddr = attrs .get (NETWORK_PEER_ADDRESS );
880- String legacyType = attrs .get (NETWORK_TYPE );
881- Long legacyPeerPort = attrs .get (NETWORK_PEER_PORT ); // <-- Long, not Integer
882-
883- // New(er) semconv keys — use literal names via AttributeKey
884- String serverAddr = attrs .get (AttributeKey .stringKey ("server.address" ));
885- Long serverPortNum = attrs .get (AttributeKey .longKey ("server.port" ));
886- String clientAddr = attrs .get (AttributeKey .stringKey ("client.address" ));
887- Long clientPortNum = attrs .get (AttributeKey .longKey ("client.port" ));
888-
889- boolean hasAddress =
890- (legacyPeerAddr != null ) || (serverAddr != null ) || (clientAddr != null );
891- boolean hasPort =
892- (legacyPeerPort != null ) || (serverPortNum != null ) || (clientPortNum != null );
893-
894- assertThat (hasAddress )
895- .as ("Expect network peer/server/client address attribute" )
896- .isTrue ();
897- assertThat (hasPort )
898- .as ("Expect network peer/server/client port attribute" )
899- .isTrue ();
900-
901- // Optional; if present must be ipv4/ipv6
902- assertThat (legacyType ).isIn ("ipv4" , "ipv6" , null );
903- });
904- });
905- }
873+ span .hasAttributesSatisfying (
874+ attributes -> {
875+ assertThat (attributes )
876+ .satisfies (
877+ attrs -> {
878+ // Legacy convention keys (already imported statically)
879+ String legacyPeerAddr = attrs .get (NETWORK_PEER_ADDRESS );
880+ String legacyType = attrs .get (NETWORK_TYPE );
881+ Long legacyPeerPort = attrs .get (NETWORK_PEER_PORT ); // <-- Long, not Integer
882+
883+ // New(er) semconv keys — use literal names via AttributeKey
884+ String serverAddr = attrs .get (AttributeKey .stringKey ("server.address" ));
885+ Long serverPortNum = attrs .get (AttributeKey .longKey ("server.port" ));
886+ String clientAddr = attrs .get (AttributeKey .stringKey ("client.address" ));
887+ Long clientPortNum = attrs .get (AttributeKey .longKey ("client.port" ));
888+
889+ boolean hasAddress =
890+ (legacyPeerAddr != null ) || (serverAddr != null ) || (clientAddr != null );
891+ boolean hasPort =
892+ (legacyPeerPort != null )
893+ || (serverPortNum != null )
894+ || (clientPortNum != null );
895+
896+ assertThat (hasAddress )
897+ .as ("Expect network peer/server/client address attribute" )
898+ .isTrue ();
899+ assertThat (hasPort )
900+ .as ("Expect network peer/server/client port attribute" )
901+ .isTrue ();
902+
903+ // Optional; if present must be ipv4/ipv6
904+ assertThat (legacyType ).isIn ("ipv4" , "ipv6" , null );
905+ });
906+ });
907+ }
908+
906909 private static void verifyException (SpanDataAssert span , Throwable exception , String errorMsg ) {
907910 span .hasStatus (StatusData .error ())
908911 .hasEventsSatisfying (
0 commit comments