Skip to content

Commit

Permalink
Remove db.connection_string (#11089)
Browse files Browse the repository at this point in the history
laurit authored Apr 12, 2024
1 parent a1466ad commit 7ff3b23
Showing 54 changed files with 135 additions and 484 deletions.
Original file line number Diff line number Diff line change
@@ -25,16 +25,11 @@ abstract class DbClientCommonAttributesExtractor<
this.getter = getter;
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Override
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
internalSet(attributes, DbIncubatingAttributes.DB_SYSTEM, getter.getSystem(request));
internalSet(attributes, DbIncubatingAttributes.DB_USER, getter.getUser(request));
internalSet(attributes, DbIncubatingAttributes.DB_NAME, getter.getName(request));
internalSet(
attributes,
DbIncubatingAttributes.DB_CONNECTION_STRING,
getter.getConnectionString(request));
}

@Override
Original file line number Diff line number Diff line change
@@ -19,6 +19,10 @@ public interface DbClientCommonAttributesGetter<REQUEST> {
@Nullable
String getName(REQUEST request);

// to be removed in 2.4.0, use `server.address` and `server.port` instead
@Nullable
String getConnectionString(REQUEST request);
@Deprecated
default String getConnectionString(REQUEST request) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -36,11 +36,6 @@ public String getName(Map<String, String> map) {
return map.get("db.name");
}

@Override
public String getConnectionString(Map<String, String> map) {
return map.get("db.connection_string");
}

@Override
public String getStatement(Map<String, String> map) {
return map.get("db.statement");
@@ -52,15 +47,13 @@ public String getOperation(Map<String, String> map) {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void shouldExtractAllAvailableAttributes() {
// given
Map<String, String> request = new HashMap<>();
request.put("db.system", "myDb");
request.put("db.user", "username");
request.put("db.name", "potatoes");
request.put("db.connection_string", "mydb:///potatoes");
request.put("db.statement", "SELECT * FROM potato");
request.put("db.operation", "SELECT");

@@ -82,7 +75,6 @@ void shouldExtractAllAvailableAttributes() {
entry(DbIncubatingAttributes.DB_SYSTEM, "myDb"),
entry(DbIncubatingAttributes.DB_USER, "username"),
entry(DbIncubatingAttributes.DB_NAME, "potatoes"),
entry(DbIncubatingAttributes.DB_CONNECTION_STRING, "mydb:///potatoes"),
entry(DbIncubatingAttributes.DB_STATEMENT, "SELECT * FROM potato"),
entry(DbIncubatingAttributes.DB_OPERATION, "SELECT"));

Original file line number Diff line number Diff line change
@@ -42,22 +42,15 @@ public String getUser(Map<String, String> map) {
public String getName(Map<String, String> map) {
return map.get("db.name");
}

@Override
public String getConnectionString(Map<String, String> map) {
return map.get("db.connection_string");
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void shouldExtractAllAttributes() {
// given
Map<String, String> request = new HashMap<>();
request.put("db.system", "myDb");
request.put("db.user", "username");
request.put("db.name", "potatoes");
request.put("db.connection_string", "mydb:///potatoes");
request.put("db.statement", "SELECT * FROM potato WHERE id=12345");

Context context = Context.root();
@@ -78,7 +71,6 @@ void shouldExtractAllAttributes() {
entry(DbIncubatingAttributes.DB_SYSTEM, "myDb"),
entry(DbIncubatingAttributes.DB_USER, "username"),
entry(DbIncubatingAttributes.DB_NAME, "potatoes"),
entry(DbIncubatingAttributes.DB_CONNECTION_STRING, "mydb:///potatoes"),
entry(DbIncubatingAttributes.DB_STATEMENT, "SELECT * FROM potato WHERE id=?"),
entry(DbIncubatingAttributes.DB_OPERATION, "SELECT"),
entry(DbIncubatingAttributes.DB_SQL_TABLE, "potato"));
Original file line number Diff line number Diff line change
@@ -28,12 +28,6 @@ public String getName(CassandraRequest request) {
return request.getSession().getLoggedKeyspace();
}

@Override
@Nullable
public String getConnectionString(CassandraRequest request) {
return null;
}

@Override
@Nullable
public String getRawStatement(CassandraRequest request) {
Original file line number Diff line number Diff line change
@@ -29,12 +29,6 @@ public String getName(CassandraRequest request) {
return request.getSession().getKeyspace().map(CqlIdentifier::toString).orElse(null);
}

@Override
@Nullable
public String getConnectionString(CassandraRequest request) {
return null;
}

@Override
@Nullable
public String getRawStatement(CassandraRequest request) {
Original file line number Diff line number Diff line change
@@ -29,12 +29,6 @@ public String getName(CassandraRequest request) {
return request.getSession().getKeyspace().map(CqlIdentifier::toString).orElse(null);
}

@Override
@Nullable
public String getConnectionString(CassandraRequest request) {
return null;
}

@Override
@Nullable
public String getRawStatement(CassandraRequest request) {
Original file line number Diff line number Diff line change
@@ -28,12 +28,6 @@ public String getName(CouchbaseRequestInfo couchbaseRequest) {
return couchbaseRequest.bucket();
}

@Override
@Nullable
public String getConnectionString(CouchbaseRequestInfo couchbaseRequest) {
return null;
}

@Override
@Nullable
public String getStatement(CouchbaseRequestInfo couchbaseRequest) {
Original file line number Diff line number Diff line change
@@ -51,12 +51,6 @@ public String getName(ElasticsearchRestRequest request) {
return null;
}

@Override
@Nullable
public String getConnectionString(ElasticsearchRestRequest request) {
return null;
}

@Override
@Nullable
public String getStatement(ElasticsearchRestRequest request) {
Original file line number Diff line number Diff line change
@@ -29,12 +29,6 @@ public String getName(ElasticTransportRequest s) {
return null;
}

@Override
@Nullable
public String getConnectionString(ElasticTransportRequest s) {
return null;
}

@Override
@Nullable
public String getStatement(ElasticTransportRequest s) {
Original file line number Diff line number Diff line change
@@ -32,12 +32,6 @@ public String getName(GeodeRequest request) {
return request.getRegion().getName();
}

@Override
@Nullable
public String getConnectionString(GeodeRequest request) {
return null;
}

@Override
@Nullable
public String getStatement(GeodeRequest request) {
Original file line number Diff line number Diff line change
@@ -57,21 +57,18 @@ static void cleanUp() {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
static SpanDataAssert assertClientSpan(SpanDataAssert span, SpanData parent) {
return span.hasKind(SpanKind.CLIENT)
.hasParent(parent)
.hasAttributesSatisfyingExactly(
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(DbIncubatingAttributes.DB_STATEMENT, val -> val.isInstanceOf(String.class)),
satisfies(DbIncubatingAttributes.DB_OPERATION, val -> val.isInstanceOf(String.class)),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "Value"));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
static SpanDataAssert assertClientSpan(SpanDataAssert span, SpanData parent, String verb) {
return span.hasName(verb.concat(" db1.Value"))
.hasKind(SpanKind.CLIENT)
@@ -80,7 +77,6 @@ static SpanDataAssert assertClientSpan(SpanDataAssert span, SpanData parent, Str
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith(verb.toLowerCase(Locale.ROOT))),
Original file line number Diff line number Diff line change
@@ -69,7 +69,6 @@ void testCriteria(String methodName, Consumer<Criteria> interaction) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith("select")),
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ class EntityManagerTest extends AbstractHibernateTest {
static final EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("test-pu");

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsHibernateActionParameters")
void testHibernateActions(Parameter parameter) {
@@ -103,7 +102,6 @@ void testHibernateActions(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -134,7 +132,6 @@ void testHibernateActions(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -184,7 +181,6 @@ private static Stream<Arguments> provideArgumentsHibernateActionParameters() {
Arguments.of(named("remove", new Parameter("delete", true, true, EntityManager::remove))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testHibernatePersist() {
EntityManager entityManager = entityManagerFactory.createEntityManager();
@@ -220,7 +216,6 @@ void testHibernatePersist() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -246,7 +241,6 @@ void testHibernatePersist() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -256,7 +250,6 @@ void testHibernatePersist() {
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "Value"))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsAttachesState")
void testAttachesStateToQuery(Function<EntityManager, Query> queryBuildMethod) {
@@ -295,7 +288,6 @@ void testAttachesStateToQuery(Function<EntityManager, Query> queryBuildMethod) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@

class QueryTest extends AbstractHibernateTest {

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testHibernateQueryExecuteUpdateWithTransaction() {
testing.runWithSpan(
@@ -64,7 +63,6 @@ void testHibernateQueryExecuteUpdateWithTransaction() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -85,7 +83,6 @@ void testHibernateQueryExecuteUpdateWithTransaction() {
.get(stringKey("hibernate.session_id"))))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("providesArgumentsSingleCall")
void testHibernateQuerySingleCall(Parameter parameter) {
@@ -122,7 +119,6 @@ void testHibernateQuerySingleCall(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
@@ -155,7 +151,6 @@ private static Stream<Arguments> providesArgumentsSingleCall() {
new Parameter("SELECT Value", sess -> sess.createQuery("from Value").scroll()))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testHibernateQueryIterate() {
testing.runWithSpan(
@@ -196,7 +191,6 @@ void testHibernateQueryIterate() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@
@SuppressWarnings("deprecation") // 'lock' is a deprecated method in the Session class
class SessionTest extends AbstractHibernateTest {

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsHibernateAction")
void testHibernateAction(Parameter parameter) {
@@ -67,7 +66,6 @@ void testHibernateAction(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -144,7 +142,6 @@ private static Stream<Arguments> provideArgumentsHibernateAction() {
null))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsHibernateActionStateless")
void testHibernateActionStateless(Parameter parameter) {
@@ -178,7 +175,6 @@ void testHibernateActionStateless(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -292,7 +288,6 @@ private static Stream<Arguments> provideArgumentsHibernateActionStateless() {
}))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsHibernateReplicate")
void testHibernateReplicate(Parameter parameter) {
@@ -325,7 +320,6 @@ void testHibernateReplicate(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -351,7 +345,6 @@ void testHibernateReplicate(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -440,7 +433,6 @@ void testHibernateFailedReplicate() {
.get(stringKey("hibernate.session_id"))))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsHibernateCommitAction")
void testHibernateCommitAction(Parameter parameter) {
@@ -485,7 +477,6 @@ void testHibernateCommitAction(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -630,7 +621,6 @@ private static Stream<Arguments> provideArgumentsHibernateCommitAction() {
null))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@MethodSource("provideArgumentsStateQuery")
void testAttachesStateToQueryCreated(Consumer<Session> queryBuilder) {
@@ -664,7 +654,6 @@ void testAttachesStateToQueryCreated(Consumer<Session> queryBuilder) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -703,7 +692,6 @@ private static Stream<Arguments> provideArgumentsStateQuery() {
session -> session.createSQLQuery("SELECT * FROM Value").list())))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testHibernateOverlappingSessions() {
testing.runWithSpan(
@@ -765,7 +753,6 @@ void testHibernateOverlappingSessions() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith("insert")),
@@ -809,7 +796,6 @@ void testHibernateOverlappingSessions() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith("insert")),
@@ -823,7 +809,6 @@ void testHibernateOverlappingSessions() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith("delete")),
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ class SpringJpaTest {
new AnnotationConfigApplicationContext(PersistenceConfig.class);
CustomerRepository repo = context.getBean(CustomerRepository.class);

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testCrud() {
String version = Version.getVersionString();
@@ -69,7 +68,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -124,7 +122,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -170,7 +167,6 @@ void testCrud() {
equalTo(
DbIncubatingAttributes.DB_STATEMENT,
"call next value for hibernate_sequence"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
equalTo(DbIncubatingAttributes.DB_OPERATION, "CALL")),
span ->
span.hasName("Transaction.commit")
@@ -191,7 +187,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -238,7 +233,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -266,7 +260,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
equalTo(
DbIncubatingAttributes.DB_STATEMENT,
"update Customer set firstName=?, lastName=? where id=?"),
@@ -304,7 +297,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -342,7 +334,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -374,7 +365,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
equalTo(
DbIncubatingAttributes.DB_STATEMENT,
"delete from Customer where id=?"),
@@ -407,7 +397,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val ->
@@ -447,7 +436,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
equalTo(
DbIncubatingAttributes.DB_STATEMENT,
"delete from Customer where id=?"),
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ private static Stream<Arguments> provideParameters() {
Arguments.of(named("getSingleResultOrNull", interactions.get(2))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest(name = "{index}: {0}")
@MethodSource("provideParameters")
void testCriteriaQuery(Consumer<Query<Value>> interaction) {
@@ -79,7 +78,6 @@ void testCriteriaQuery(Consumer<Query<Value>> interaction) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith("select")),
Original file line number Diff line number Diff line change
@@ -112,7 +112,6 @@ void testHibernateAction(Parameter parameter) {
});
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest(name = "{index}: {0}")
@MethodSource("provideAttachesStateParameters")
void testAttachesStateToQuery(Parameter parameter) {
@@ -141,7 +140,6 @@ void testAttachesStateToQuery(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -288,21 +286,18 @@ private static class Parameter {
public final Function<EntityManager, Query> queryBuildMethod;
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
private static SpanDataAssert assertClientSpan(SpanDataAssert span, SpanData parent) {
return span.hasKind(SpanKind.CLIENT)
.hasParent(parent)
.hasAttributesSatisfyingExactly(
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(DbIncubatingAttributes.DB_STATEMENT, val -> val.isInstanceOf(String.class)),
satisfies(DbIncubatingAttributes.DB_OPERATION, val -> val.isInstanceOf(String.class)),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "Value"));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
private static SpanDataAssert assertClientSpan(
SpanDataAssert span, SpanData parent, String spanName) {
return span.hasName(spanName)
@@ -312,7 +307,6 @@ private static SpanDataAssert assertClientSpan(
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(DbIncubatingAttributes.DB_STATEMENT, val -> val.isInstanceOf(String.class)),
satisfies(DbIncubatingAttributes.DB_OPERATION, val -> val.isInstanceOf(String.class)),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "Value"));
Original file line number Diff line number Diff line change
@@ -69,7 +69,6 @@ static void cleanup() {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testProcedureCall() {
testing.runWithSpan(
@@ -105,7 +104,6 @@ void testProcedureCall() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "{call TEST_PROC()}"),
equalTo(DbIncubatingAttributes.DB_OPERATION, "CALL")),
span ->
Original file line number Diff line number Diff line change
@@ -219,7 +219,6 @@ void testHibernateCommitAction(Parameter parameter) {
span -> assertClientSpan(span, trace.getSpan(2))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest(name = "{index}: {0}")
@MethodSource("provideAttachesStateToQueryParameters")
void testAttachesStateToQuery(Parameter parameter) {
@@ -246,7 +245,6 @@ void testAttachesStateToQuery(Parameter parameter) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.isInstanceOf(String.class)),
@@ -803,21 +801,18 @@ private static SpanDataAssert assertSpanWithSessionId(
equalTo(AttributeKey.stringKey("hibernate.session_id"), sessionId));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
private static SpanDataAssert assertClientSpan(SpanDataAssert span, SpanData parent) {
return span.hasKind(SpanKind.CLIENT)
.hasParent(parent)
.hasAttributesSatisfyingExactly(
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(DbIncubatingAttributes.DB_STATEMENT, val -> val.isInstanceOf(String.class)),
satisfies(DbIncubatingAttributes.DB_OPERATION, val -> val.isInstanceOf(String.class)),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "Value"));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
private static SpanDataAssert assertClientSpan(
SpanDataAssert span, SpanData parent, String verb) {
return span.hasName(verb.concat(" db1.Value"))
@@ -827,7 +822,6 @@ private static SpanDataAssert assertClientSpan(
equalTo(DbIncubatingAttributes.DB_SYSTEM, "h2"),
equalTo(DbIncubatingAttributes.DB_NAME, "db1"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith(verb.toLowerCase(Locale.ROOT))),
Original file line number Diff line number Diff line change
@@ -23,7 +23,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
@Shared
def repo = context.getBean(CustomerRepository)

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "test CRUD"() {
setup:
def isHibernate4 = Version.getVersionString().startsWith("4.")
@@ -64,7 +63,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName(.*)from Customer(.*)/
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -121,7 +119,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_STATEMENT" "call next value for Customer_SEQ"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_OPERATION" "CALL"
}
}
@@ -141,7 +138,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/insert into Customer \(.*\) values \(.*\)/
"$DbIncubatingAttributes.DB_OPERATION" "INSERT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -156,7 +152,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/insert into Customer \(.*\) values \(.*\)/
"$DbIncubatingAttributes.DB_OPERATION" "INSERT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -211,7 +206,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -232,7 +226,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/update Customer set firstName=\?,(.*)lastName=\? where id=\?/
"$DbIncubatingAttributes.DB_OPERATION" "UPDATE"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -275,7 +268,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)(where ([^.]+)\.lastName( ?)=( ?)\?|)/
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -319,7 +311,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -344,7 +335,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" ~/select ([^.]+)\.id([^,]*),([^.]+)\.firstName([^,]*),([^.]+)\.lastName (.*)from Customer (.*)where ([^.]+)\.id( ?)=( ?)\?/
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
@@ -374,7 +364,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "sa"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" "delete from Customer where id=?"
"$DbIncubatingAttributes.DB_OPERATION" "DELETE"
"$DbIncubatingAttributes.DB_SQL_TABLE" "Customer"
Original file line number Diff line number Diff line change
@@ -76,7 +76,6 @@ static void cleanUp() {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testProcedureCall() {

@@ -118,7 +117,6 @@ void testProcedureCall() {
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "{call TEST_PROC()}"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
equalTo(DbIncubatingAttributes.DB_OPERATION, "CALL")),
span ->
span.hasName("Transaction.commit")
Original file line number Diff line number Diff line change
@@ -167,7 +167,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "basic statement with #connection.getClass().getCanonicalName() on #system generates spans"() {
setup:
Statement statement = connection.createStatement()
@@ -195,7 +194,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
if (username != null) {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_STATEMENT" sanitizedQuery
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
@@ -255,7 +253,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
if (username != null) {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_STATEMENT" sanitizedQuery
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
@@ -307,7 +304,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
if (username != null) {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_STATEMENT" sanitizedQuery
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
@@ -359,7 +355,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
if (username != null) {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_STATEMENT" sanitizedQuery
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
@@ -412,7 +407,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_STATEMENT" query
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_OPERATION" "CREATE TABLE"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
}
@@ -467,7 +461,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_STATEMENT" query
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_OPERATION" "CREATE TABLE"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
}
@@ -533,7 +526,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
if (username != null) {
"$DbIncubatingAttributes.DB_USER" username
}
"$DbIncubatingAttributes.DB_CONNECTION_STRING" url
"$DbIncubatingAttributes.DB_STATEMENT" sanitizedQuery
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" table
@@ -590,7 +582,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" system
"$DbIncubatingAttributes.DB_USER" { user == null | user == it }
"$DbIncubatingAttributes.DB_NAME" "jdbcunittest"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" connectionString
}
}
if (recursive) {
@@ -604,7 +595,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" system
"$DbIncubatingAttributes.DB_USER" { user == null | user == it }
"$DbIncubatingAttributes.DB_NAME" "jdbcunittest"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" connectionString
}
}
}
@@ -653,7 +643,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
attributes {
"$DbIncubatingAttributes.DB_SYSTEM" "other_sql"
"$DbIncubatingAttributes.DB_STATEMENT" "testing ?"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "testdb://localhost"
"$ServerAttributes.SERVER_ADDRESS" "localhost"
}
}
@@ -694,7 +683,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
attributes {
"$DbIncubatingAttributes.DB_SYSTEM" "other_sql"
"$DbIncubatingAttributes.DB_NAME" databaseName
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "testdb://localhost"
"$DbIncubatingAttributes.DB_STATEMENT" sanitizedQuery
"$DbIncubatingAttributes.DB_OPERATION" operation
"$DbIncubatingAttributes.DB_SQL_TABLE" table
@@ -752,7 +740,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" dbNameLower
"$DbIncubatingAttributes.DB_USER" "SA"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT ? FROM INFORMATION_SCHEMA.SYSTEM_USERS"
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "INFORMATION_SCHEMA.SYSTEM_USERS"
@@ -799,7 +786,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
childOf span(0)
attributes {
"$DbIncubatingAttributes.DB_SYSTEM" "other_sql"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "testdb://localhost"
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT * FROM table"
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "table"
Original file line number Diff line number Diff line change
@@ -85,10 +85,6 @@ class SlickTest {
),
equalTo(DbIncubatingAttributes.DB_NAME, Db),
equalTo(DbIncubatingAttributes.DB_USER, Username),
equalTo(
DbIncubatingAttributes.DB_CONNECTION_STRING,
"h2:mem:"
),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "SELECT ?"),
equalTo(DbIncubatingAttributes.DB_OPERATION, "SELECT")
)
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ enum DataSourceDbAttributesExtractor implements AttributesExtractor<DataSource,
@Override
public void onStart(AttributesBuilder attributes, Context parentContext, DataSource dataSource) {}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Override
public void onEnd(
AttributesBuilder attributes,
@@ -35,7 +34,6 @@ public void onEnd(
internalSet(attributes, DbIncubatingAttributes.DB_SYSTEM, dbInfo.getSystem());
internalSet(attributes, DbIncubatingAttributes.DB_USER, dbInfo.getUser());
internalSet(attributes, DbIncubatingAttributes.DB_NAME, getName(dbInfo));
internalSet(attributes, DbIncubatingAttributes.DB_CONNECTION_STRING, dbInfo.getShortUrl());
}

private static String getName(DbInfo dbInfo) {
Original file line number Diff line number Diff line change
@@ -34,12 +34,6 @@ public String getName(DbRequest request) {
return dbInfo.getName() == null ? dbInfo.getDb() : dbInfo.getName();
}

@Nullable
@Override
public String getConnectionString(DbRequest request) {
return request.getDbInfo().getShortUrl();
}

@Nullable
@Override
public String getRawStatement(DbRequest request) {
Original file line number Diff line number Diff line change
@@ -887,38 +887,15 @@ public static DbInfo parse(String connectionUrl, Properties props) {
try {
if (typeParsers.containsKey(type)) {
// Delegate to specific parser
return withUrl(typeParsers.get(type).doParse(jdbcUrl, parsedProps), type);
return typeParsers.get(type).doParse(jdbcUrl, parsedProps).build();
}
return withUrl(GENERIC_URL_LIKE.doParse(jdbcUrl, parsedProps), type);
return GENERIC_URL_LIKE.doParse(jdbcUrl, parsedProps).build();
} catch (RuntimeException e) {
logger.log(FINE, "Error parsing URL", e);
return parsedProps.build();
}
}

private static DbInfo withUrl(DbInfo.Builder builder, String type) {
DbInfo info = builder.build();
StringBuilder url = new StringBuilder();
url.append(type);
url.append(':');
String subtype = info.getSubtype();
if (subtype != null) {
url.append(subtype);
url.append(':');
}
String host = info.getHost();
if (host != null) {
url.append("//");
url.append(host);
Integer port = info.getPort();
if (port != null) {
url.append(':');
url.append(port);
}
}
return builder.shortUrl(url.toString()).build();
}

// Source: https://stackoverflow.com/a/13592567
private static Map<String, String> splitQuery(String query, String separator) {
if (query == null || query.isEmpty()) {
Original file line number Diff line number Diff line change
@@ -27,10 +27,6 @@ public static DbInfo.Builder builder() {
@Nullable
public abstract String getSubtype();

// "type:[subtype:]//host:port"
@Nullable
public abstract String getShortUrl();

@Nullable
public abstract String getUser();

@@ -50,7 +46,6 @@ public Builder toBuilder() {
return builder()
.system(getSystem())
.subtype(getSubtype())
.shortUrl(getShortUrl())
.user(getUser())
.name(getName())
.db(getDb())
@@ -69,8 +64,6 @@ public abstract static class Builder {

public abstract Builder subtype(String subtype);

public abstract Builder shortUrl(String shortUrl);

public abstract Builder user(String user);

public abstract Builder name(String name);
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ import static io.opentelemetry.instrumentation.jdbc.internal.JdbcInstrumenterFac

class OpenTelemetryConnectionTest extends InstrumentationSpecification implements LibraryTestTrait {

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "verify create statement"() {
setup:
def instr = createStatementInstrumenter(openTelemetry)
@@ -52,7 +51,6 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
"$DbIncubatingAttributes.DB_SYSTEM" dbInfo.system
"$DbIncubatingAttributes.DB_NAME" dbInfo.name
"$DbIncubatingAttributes.DB_USER" dbInfo.user
"$DbIncubatingAttributes.DB_CONNECTION_STRING" dbInfo.shortUrl
"$ServerAttributes.SERVER_ADDRESS" dbInfo.host
"$ServerAttributes.SERVER_PORT" dbInfo.port
"$DbIncubatingAttributes.DB_STATEMENT" query
@@ -81,7 +79,6 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
connection.createStatement().instrumenter == instr
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "verify prepare statement"() {
setup:
def instr = createStatementInstrumenter(openTelemetry)
@@ -109,7 +106,6 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
"$DbIncubatingAttributes.DB_SYSTEM" dbInfo.system
"$DbIncubatingAttributes.DB_NAME" dbInfo.name
"$DbIncubatingAttributes.DB_USER" dbInfo.user
"$DbIncubatingAttributes.DB_CONNECTION_STRING" dbInfo.shortUrl
"$ServerAttributes.SERVER_ADDRESS" dbInfo.host
"$ServerAttributes.SERVER_PORT" dbInfo.port
"$DbIncubatingAttributes.DB_STATEMENT" query
@@ -142,7 +138,6 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
connection.prepareStatement(query).instrumenter == instr
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "verify prepare call"() {
setup:
def instr = createStatementInstrumenter(openTelemetry)
@@ -170,7 +165,6 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
"$DbIncubatingAttributes.DB_SYSTEM" dbInfo.system
"$DbIncubatingAttributes.DB_NAME" dbInfo.name
"$DbIncubatingAttributes.DB_USER" dbInfo.user
"$DbIncubatingAttributes.DB_CONNECTION_STRING" dbInfo.shortUrl
"$ServerAttributes.SERVER_ADDRESS" dbInfo.host
"$ServerAttributes.SERVER_PORT" dbInfo.port
"$DbIncubatingAttributes.DB_STATEMENT" query
@@ -204,7 +198,6 @@ class OpenTelemetryConnectionTest extends InstrumentationSpecification implement
DbInfo.builder()
.system("my_system")
.subtype("my_sub_type")
.shortUrl("my_connection_string")
.user("my_user")
.name("my_name")
.db("my_db")

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -33,7 +33,6 @@ class OpenTelemetryDataSourceTest {
@RegisterExtension
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest
@ArgumentsSource(GetConnectionMethods.class)
void shouldEmitGetConnectionSpans(GetConnectionFunction getConnection) throws SQLException {
@@ -56,10 +55,7 @@ void shouldEmitGetConnectionSpans(GetConnectionFunction getConnection) throws SQ
TestDataSource.class.getName()),
equalTo(CodeIncubatingAttributes.CODE_FUNCTION, "getConnection"),
equalTo(DbIncubatingAttributes.DB_SYSTEM, "postgresql"),
equalTo(DbIncubatingAttributes.DB_NAME, "dbname"),
equalTo(
DbIncubatingAttributes.DB_CONNECTION_STRING,
"postgresql://127.0.0.1:5432"))));
equalTo(DbIncubatingAttributes.DB_NAME, "dbname"))));

assertThat(connection).isExactlyInstanceOf(OpenTelemetryConnection.class);
DbInfo dbInfo = ((OpenTelemetryConnection) connection).getDbInfo();
@@ -101,7 +97,6 @@ interface GetConnectionFunction {
private static void assertDbInfo(DbInfo dbInfo) {
assertThat(dbInfo.getSystem()).isEqualTo("postgresql");
assertNull(dbInfo.getSubtype());
assertThat(dbInfo.getShortUrl()).isEqualTo("postgresql://127.0.0.1:5432");
assertNull(dbInfo.getUser());
assertNull(dbInfo.getName());
assertThat(dbInfo.getDb()).isEqualTo("dbname");
Original file line number Diff line number Diff line change
@@ -32,11 +32,6 @@ public String getName(JedisRequest request) {
return null;
}

@Override
public String getConnectionString(JedisRequest request) {
return null;
}

@Override
public String getStatement(JedisRequest request) {
return sanitizer.sanitize(request.getCommand().name(), request.getArgs());
Original file line number Diff line number Diff line change
@@ -27,11 +27,6 @@ public String getName(JedisRequest request) {
return null;
}

@Override
public String getConnectionString(JedisRequest request) {
return null;
}

@Override
public String getStatement(JedisRequest request) {
return request.getStatement();
Original file line number Diff line number Diff line change
@@ -27,11 +27,6 @@ public String getName(JedisRequest request) {
return null;
}

@Override
public String getConnectionString(JedisRequest request) {
return null;
}

@Override
public String getStatement(JedisRequest request) {
return request.getStatement();
Original file line number Diff line number Diff line change
@@ -29,12 +29,6 @@ public String getName(RedisCommand<?, ?, ?> request) {
return null;
}

@Override
@Nullable
public String getConnectionString(RedisCommand<?, ?, ?> request) {
return null;
}

@Override
public String getStatement(RedisCommand<?, ?, ?> request) {
return null;
Original file line number Diff line number Diff line change
@@ -37,12 +37,6 @@ public String getName(RedisCommand<?, ?, ?> request) {
return null;
}

@Override
@Nullable
public String getConnectionString(RedisCommand<?, ?, ?> request) {
return null;
}

@Override
public String getStatement(RedisCommand<?, ?, ?> request) {
String command = LettuceInstrumentationUtil.getCommandName(request);
Original file line number Diff line number Diff line change
@@ -5,8 +5,6 @@

package io.opentelemetry.instrumentation.mongo.v3_1;

import com.mongodb.ServerAddress;
import com.mongodb.connection.ConnectionDescription;
import com.mongodb.event.CommandStartedEvent;
import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientAttributesGetter;
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;
@@ -64,24 +62,6 @@ public String getName(CommandStartedEvent event) {
return event.getDatabaseName();
}

@Override
@Nullable
public String getConnectionString(CommandStartedEvent event) {
ConnectionDescription connectionDescription = event.getConnectionDescription();
if (connectionDescription != null) {
ServerAddress sa = connectionDescription.getServerAddress();
if (sa != null) {
// https://docs.mongodb.com/manual/reference/connection-string/
String host = sa.getHost();
int port = sa.getPort();
if (host != null && port != 0) {
return "mongodb://" + host + ":" + port;
}
}
}
return null;
}

@Override
public String getStatement(CommandStartedEvent event) {
return sanitizeStatement(event.getCommand());
Original file line number Diff line number Diff line change
@@ -399,7 +399,6 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
return "testCollection-${collectionIndex.getAndIncrement()}"
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def mongoSpan(TraceAssert trace, int index,
String operation, String collection,
String dbName, Object parentSpan,
@@ -419,7 +418,6 @@ abstract class AbstractMongoClientTest<T> extends InstrumentationSpecification {
statementEval.call(it.replaceAll(" ", ""))
}
"$DbIncubatingAttributes.DB_SYSTEM" "mongodb"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "mongodb://localhost:" + port
"$DbIncubatingAttributes.DB_NAME" dbName
"$DbIncubatingAttributes.DB_OPERATION" operation
"$DbIncubatingAttributes.DB_MONGODB_COLLECTION" collection
Original file line number Diff line number Diff line change
@@ -29,12 +29,6 @@ public String getName(OpenSearchRestRequest request) {
return null;
}

@Override
@Nullable
public String getConnectionString(OpenSearchRestRequest request) {
return null;
}

@Override
@Nullable
public String getStatement(OpenSearchRestRequest request) {
Original file line number Diff line number Diff line change
@@ -6,10 +6,8 @@
package io.opentelemetry.instrumentation.r2dbc.v1_0.internal;

import static io.r2dbc.spi.ConnectionFactoryOptions.DATABASE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DRIVER;
import static io.r2dbc.spi.ConnectionFactoryOptions.HOST;
import static io.r2dbc.spi.ConnectionFactoryOptions.PORT;
import static io.r2dbc.spi.ConnectionFactoryOptions.PROTOCOL;
import static io.r2dbc.spi.ConnectionFactoryOptions.USER;

import io.opentelemetry.context.Context;
@@ -31,7 +29,6 @@ public final class DbExecution {
private final String name;
private final String host;
private final Integer port;
private final String connectionString;
private final String rawStatement;

private Context context;
@@ -51,19 +48,8 @@ public DbExecution(QueryExecutionInfo queryInfo, ConnectionFactoryOptions factor
factoryOptions.hasOption(DATABASE)
? ((String) factoryOptions.getValue(DATABASE)).toLowerCase(Locale.ROOT)
: null;
String driver =
factoryOptions.hasOption(DRIVER) ? (String) factoryOptions.getValue(DRIVER) : null;
String protocol =
factoryOptions.hasOption(PROTOCOL) ? (String) factoryOptions.getValue(PROTOCOL) : null;
this.host = factoryOptions.hasOption(HOST) ? (String) factoryOptions.getValue(HOST) : null;
this.port = factoryOptions.hasOption(PORT) ? (Integer) factoryOptions.getValue(PORT) : null;
this.connectionString =
String.format(
"%s%s:%s%s",
driver != null ? driver : "",
protocol != null ? ":" + protocol : "",
host != null ? "//" + host : "",
port != null ? ":" + port : "");
this.rawStatement =
queryInfo.getQueries().stream().map(QueryInfo::getQuery).collect(Collectors.joining(";\n"));
}
@@ -88,10 +74,6 @@ public String getName() {
return name;
}

public String getConnectionString() {
return connectionString;
}

public String getRawStatement() {
return rawStatement;
}
@@ -121,8 +103,6 @@ public String toString() {
+ '\''
+ ", port="
+ port
+ ", connectionString='"
+ connectionString
+ '\''
+ ", rawStatement='"
+ rawStatement
Original file line number Diff line number Diff line change
@@ -32,12 +32,6 @@ public String getName(DbExecution request) {
return request.getName();
}

@Override
@Nullable
public String getConnectionString(DbExecution request) {
return request.getConnectionString();
}

@Override
@Nullable
public String getRawStatement(DbExecution request) {
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ void dbExecution() {
assertEquals("db", dbExecution.getName());
assertEquals("localhost", dbExecution.getHost());
assertEquals(3306, dbExecution.getPort());
assertEquals("mariadb://localhost:3306", dbExecution.getConnectionString());
assertEquals("SELECT * from person where last_name = 'tom'", dbExecution.getRawStatement());
}
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS;
import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_CONNECTION_STRING;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_NAME;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SQL_TABLE;
@@ -124,7 +123,6 @@ void startContainer(DbSystemProps props) {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@ParameterizedTest(name = "{index}: {0}")
@MethodSource("provideParameters")
void testQueries(Parameter parameter) {
@@ -166,9 +164,6 @@ void testQueries(Parameter parameter) {
.hasKind(SpanKind.CLIENT)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(
DB_CONNECTION_STRING,
parameter.system + "://localhost:" + port),
equalTo(DB_SYSTEM, parameter.system),
equalTo(DB_NAME, DB),
equalTo(DB_USER, USER_DB),
Original file line number Diff line number Diff line change
@@ -30,12 +30,6 @@ public String getName(RedisCommand<?, ?> redisCommand) {
return null;
}

@Override
@Nullable
public String getConnectionString(RedisCommand<?, ?> redisCommand) {
return null;
}

@Override
@Nullable
public String getStatement(RedisCommand<?, ?> redisCommand) {
Original file line number Diff line number Diff line change
@@ -28,11 +28,6 @@ public String getName(RedissonRequest request) {
return null;
}

@Override
public String getConnectionString(RedissonRequest request) {
return null;
}

@Override
public String getStatement(RedissonRequest request) {
return request.getStatement();
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_CONNECTION_STRING;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_NAME;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SQL_TABLE;
@@ -49,7 +48,6 @@ static void cleanUp() {
applicationContext.close();
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testFindAll() {
long count =
@@ -87,7 +85,6 @@ void testFindAll() {
equalTo(DB_STATEMENT, "SELECT CUSTOMER.* FROM CUSTOMER"),
equalTo(DB_OPERATION, "SELECT"),
equalTo(DB_SQL_TABLE, "CUSTOMER"),
equalTo(DB_CONNECTION_STRING, "h2:mem://localhost"),
equalTo(SERVER_ADDRESS, "localhost"))));
}
}
Original file line number Diff line number Diff line change
@@ -66,7 +66,6 @@ void testObjectMethod() {
span -> span.hasName("toString test").hasTotalAttributeCount(0)));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
static void assertHibernate4Trace(TraceAssert trace, String repoClassName) {
trace.hasSpansSatisfyingExactly(
span ->
@@ -83,14 +82,12 @@ static void assertHibernate4Trace(TraceAssert trace, String repoClassName) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT, val -> val.startsWith("insert ")),
equalTo(DbIncubatingAttributes.DB_OPERATION, "INSERT"),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "JpaCustomer")));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
static void assertHibernateTrace(TraceAssert trace, String repoClassName) {
trace.hasSpansSatisfyingExactly(
span ->
@@ -106,7 +103,6 @@ static void assertHibernateTrace(TraceAssert trace, String repoClassName) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("call next value for ")),
@@ -119,14 +115,12 @@ static void assertHibernateTrace(TraceAssert trace, String repoClassName) {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT, val -> val.startsWith("insert ")),
equalTo(DbIncubatingAttributes.DB_OPERATION, "INSERT"),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "JpaCustomer")));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testCrud() {
boolean isHibernate4 = Version.getVersionString().startsWith("4.");
@@ -155,7 +149,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
@@ -193,7 +186,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
@@ -207,7 +199,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("update ")),
@@ -233,7 +224,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
@@ -259,7 +249,6 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
@@ -273,15 +262,13 @@ void testCrud() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("delete ")),
equalTo(DbIncubatingAttributes.DB_OPERATION, "DELETE"),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "JpaCustomer"))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testCustomRepositoryMethod() {
REPOSITORY repo = repository();
@@ -308,15 +295,13 @@ void testCustomRepositoryMethod() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
equalTo(DbIncubatingAttributes.DB_OPERATION, "SELECT"),
equalTo(DbIncubatingAttributes.DB_SQL_TABLE, "JpaCustomer"))));
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
@Test
void testFailedRepositoryMethod() {
// given
@@ -355,7 +340,6 @@ void testFailedRepositoryMethod() {
equalTo(DbIncubatingAttributes.DB_SYSTEM, "hsqldb"),
equalTo(DbIncubatingAttributes.DB_NAME, "test"),
equalTo(DbIncubatingAttributes.DB_USER, "sa"),
equalTo(DbIncubatingAttributes.DB_CONNECTION_STRING, "hsqldb:mem:"),
satisfies(
DbIncubatingAttributes.DB_STATEMENT,
val -> val.startsWith("select ")),
Original file line number Diff line number Diff line change
@@ -27,12 +27,6 @@ public String getName(SpymemcachedRequest spymemcachedRequest) {
return null;
}

@Override
@Nullable
public String getConnectionString(SpymemcachedRequest spymemcachedRequest) {
return null;
}

@Override
@Nullable
public String getStatement(SpymemcachedRequest spymemcachedRequest) {
Original file line number Diff line number Diff line change
@@ -35,12 +35,6 @@ public String getName(VertxRedisClientRequest request) {
return null;
}

@Override
@Nullable
public String getConnectionString(VertxRedisClientRequest request) {
return request.getConnectionString();
}

@Override
public String getStatement(VertxRedisClientRequest request) {
return sanitizer.sanitize(request.getCommand(), request.getArgs());
Original file line number Diff line number Diff line change
@@ -41,10 +41,6 @@ public Long getDatabaseIndex() {
return select != null ? select.longValue() : null;
}

public String getConnectionString() {
return null;
}

public String getHost() {
return redisUri.socketAddress().host();
}
Original file line number Diff line number Diff line change
@@ -53,7 +53,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {

//Verifies that context is correctly propagated and sql query span has correct parent.
//Tests io.opentelemetry.javaagent.instrumentation.vertx.reactive.VertxRxInstrumentation
@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "should propagate context over vert.x rx-java framework"() {
setup:
def response = client.get("/listProducts").aggregate().join()
@@ -101,7 +100,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "SA"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT id, name, price, weight FROM products"
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "products"
@@ -111,7 +109,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
}
}

@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "should propagate context correctly over vert.x rx-java framework with high concurrency"() {
setup:
int count = 100
@@ -201,7 +198,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "SA"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT id AS request$requestId, name, price, weight FROM products"
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "products"
Original file line number Diff line number Diff line change
@@ -53,7 +53,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {

//Verifies that context is correctly propagated and sql query span has correct parent.
//Tests io.opentelemetry.javaagent.instrumentation.vertx.reactive.VertxRxInstrumentation
@SuppressWarnings("deprecation") // TODO DbIncubatingAttributes.DB_CONNECTION_STRING deprecation
def "should propagate context over vert.x rx-java framework"() {
setup:
def response = client.get("/listProducts").aggregate().join()
@@ -101,7 +100,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "SA"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT id, name, price, weight FROM products"
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "products"
@@ -200,7 +198,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
"$DbIncubatingAttributes.DB_SYSTEM" "hsqldb"
"$DbIncubatingAttributes.DB_NAME" "test"
"$DbIncubatingAttributes.DB_USER" "SA"
"$DbIncubatingAttributes.DB_CONNECTION_STRING" "hsqldb:mem:"
"$DbIncubatingAttributes.DB_STATEMENT" "SELECT id AS request$requestId, name, price, weight FROM products"
"$DbIncubatingAttributes.DB_OPERATION" "SELECT"
"$DbIncubatingAttributes.DB_SQL_TABLE" "products"
Original file line number Diff line number Diff line change
@@ -29,12 +29,6 @@ public String getName(VertxSqlClientRequest request) {
return request.getDatabase();
}

@Override
@Nullable
public String getConnectionString(VertxSqlClientRequest request) {
return null;
}

@Override
@Nullable
public String getRawStatement(VertxSqlClientRequest request) {

0 comments on commit 7ff3b23

Please sign in to comment.