Skip to content

Commit a8a700f

Browse files
committed
fix merge
1 parent 0dddcf8 commit a8a700f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

instrumentation/jdbc/library/src/test/java/io/opentelemetry/instrumentation/jdbc/JdbcInstrumentationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,9 @@ protected Connection wrap(Connection connection) throws SQLException {
3939
protected DataSource wrap(DataSource dataSource) {
4040
return telemetry.wrap(dataSource);
4141
}
42+
43+
@Override
44+
protected boolean hasPeerService() {
45+
return false;
46+
}
4247
}

instrumentation/jdbc/testing/src/main/java/io/opentelemetry/instrumentation/jdbc/testing/AbstractJdbcInstrumentationTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_STATEMENT;
2626
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM;
2727
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_USER;
28+
import static io.opentelemetry.semconv.incubating.PeerIncubatingAttributes.PEER_SERVICE;
2829
import static java.util.Arrays.asList;
2930
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3031

@@ -90,6 +91,10 @@ protected DataSource wrap(DataSource dataSource) {
9091
return dataSource;
9192
}
9293

94+
protected boolean hasPeerService() {
95+
return true;
96+
}
97+
9398
private static final String dbName = "jdbcUnitTest";
9499
private static final String dbNameLower = dbName.toLowerCase(Locale.ROOT);
95100
private static final Map<String, String> jdbcUrls =
@@ -1166,6 +1171,7 @@ void testGetClientInfoException(String query) throws SQLException {
11661171
equalTo(
11671172
DB_CONNECTION_STRING,
11681173
emitStableDatabaseSemconv() ? null : "testdb://localhost"),
1174+
equalTo(PEER_SERVICE, hasPeerService() ? "test-peer-service" : null),
11691175
equalTo(SERVER_ADDRESS, "localhost"))));
11701176
}
11711177

@@ -1254,6 +1260,7 @@ void testProduceProperSpanName(
12541260
equalTo(maybeStable(DB_STATEMENT), sanitizedQuery),
12551261
equalTo(maybeStable(DB_OPERATION), operation),
12561262
equalTo(maybeStable(DB_SQL_TABLE), table),
1263+
equalTo(PEER_SERVICE, hasPeerService() ? "test-peer-service" : null),
12571264
equalTo(SERVER_ADDRESS, "localhost"))));
12581265
}
12591266

@@ -1379,6 +1386,7 @@ void testHandleRecursiveStatements(
13791386
equalTo(maybeStable(DB_STATEMENT), "SELECT * FROM table"),
13801387
equalTo(maybeStable(DB_OPERATION), "SELECT"),
13811388
equalTo(maybeStable(DB_SQL_TABLE), "table"),
1389+
equalTo(PEER_SERVICE, hasPeerService() ? "test-peer-service" : null),
13821390
equalTo(SERVER_ADDRESS, "localhost"))));
13831391
}
13841392

0 commit comments

Comments
 (0)