@@ -1061,9 +1061,7 @@ private void validateHttpStatusForNonLocalRootWithThrowableForClient(
10611061
10621062 @ Test
10631063 public void testDBUserAttribute () {
1064- mockAttribute (DB_SYSTEM , "db_system" );
10651064 mockAttribute (DB_OPERATION , "db_operation" );
1066- mockAttribute (DB_STATEMENT , "db_statement" );
10671065 mockAttribute (DB_USER , "db_user" );
10681066 when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
10691067
@@ -1075,6 +1073,7 @@ public void testDBUserAttribute() {
10751073
10761074 @ Test
10771075 public void testDBUserAttributeAbsent () {
1076+ mockAttribute (DB_SYSTEM , "db_system" );
10781077 when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
10791078
10801079 Attributes actualAttributes =
@@ -1084,9 +1083,7 @@ public void testDBUserAttributeAbsent() {
10841083
10851084 @ Test
10861085 public void testDBUserAttributeWithDifferentValues () {
1087- mockAttribute (DB_SYSTEM , "db_system" );
10881086 mockAttribute (DB_OPERATION , "db_operation" );
1089- mockAttribute (DB_STATEMENT , "db_statement" );
10901087 mockAttribute (DB_USER , "non_db_user" );
10911088 when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
10921089
@@ -1097,8 +1094,8 @@ public void testDBUserAttributeWithDifferentValues() {
10971094
10981095 @ Test
10991096 public void testDBUserAttributeNotPresentInServiceMetricForServerSpan () {
1100- String dbUser = "db_user" ;
1101- mockAttribute (DB_USER , dbUser );
1097+ mockAttribute ( DB_USER , "db_user" ) ;
1098+ mockAttribute (DB_SYSTEM , "db_system" );
11021099 when (spanDataMock .getKind ()).thenReturn (SpanKind .SERVER );
11031100
11041101 Attributes actualAttributes =
@@ -1107,34 +1104,13 @@ public void testDBUserAttributeNotPresentInServiceMetricForServerSpan() {
11071104 }
11081105
11091106 @ Test
1110- public void testIsDbSpanTrueWhenDbSystemKeyIsPresent () {
1111- mockAttribute (DB_SYSTEM , "DB system" );
1112- when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
1113-
1114- assertThat (AwsSpanProcessingUtil .isDBSpan (spanDataMock )).isTrue ();
1115- }
1116-
1117- @ Test
1118- public void testIsDbSpanTrueWhenDbOperationKeyIsPresent () {
1119- mockAttribute (DB_OPERATION , "DB operation" );
1120- when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
1121-
1122- assertThat (AwsSpanProcessingUtil .isDBSpan (spanDataMock )).isTrue ();
1123- }
1124-
1125- @ Test
1126- public void testIsDbSpanFalseWhenOnlyDbUserKeyIsPresent () {
1107+ public void testDbUserPresentAndIsDbSpanFalse () {
11271108 mockAttribute (DB_USER , "DB user" );
11281109 when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
11291110
1130- assertThat (AwsSpanProcessingUtil .isDBSpan (spanDataMock )).isFalse ();
1131- }
1132-
1133- @ Test
1134- public void testIsDbSpanFalse () {
1135- when (spanDataMock .getKind ()).thenReturn (SpanKind .CLIENT );
1136-
1137- assertThat (AwsSpanProcessingUtil .isDBSpan (spanDataMock )).isFalse ();
1111+ Attributes actualAttributes =
1112+ GENERATOR .generateMetricAttributeMapFromSpan (spanDataMock , resource ).get (DEPENDENCY_METRIC );
1113+ assertThat (actualAttributes .get (AWS_REMOTE_DB_USER )).isNull ();
11381114 }
11391115
11401116 @ Test
0 commit comments