-
Notifications
You must be signed in to change notification settings - Fork 14
v1.1 Release Notes
When jdbc.event.enabled property is set to true, JdbcEventPublishingListener is registered and publishes JdbcQueryExecutionEvent and JdbcQueryExecutionEvent as Spring application events.
The ResultSetContext observation context now holds a list of ResultSetOperation instances, representing interactions with a ResultSet.
For example, the following JDBC query results in recorded operations:
String query = "select id, job, name from emp where name != ?";
try (PreparedStatement ps = connection.prepareStatement(query)) {
ps.setString(1, "Foo");
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
Integer id = rs.getInt("id");
String job = rs.getString("job");
// Process result
}
}
}| Method | Arguments | Value |
|---|---|---|
next |
null |
true |
getInt |
["id"] |
1 |
getString |
["job"] |
"engineer" |
next |
null |
true |
getInt |
["id"] |
2 |
getString |
["job"] |
"teacher" |
next |
null |
false |
close |
null |
null |
This allows for generating an easy visualization of query results like this:
| id | job |
|---|---|
| 1 | engineer |
| 2 | teacher |
A new observation has been introduced for tracking generated keys.
When inserting records with auto-generated keys, Statement#getGeneratedKeys() returns a ResultSet. The interactions with this ResultSet create a new observation, tagging retrieved keys.
PreparedStatement stmt = conn.prepareStatement(
"INSERT INTO emp (name) VALUES (?)",
Statement.RETURN_GENERATED_KEYS
);
stmt.setString(1, "FOO");
stmt.executeUpdate();
try (ResultSet rs = stmt.getGeneratedKeys()) {
rs.next();
Integer id = rs.getInt(1);
}If the insert generates id=100, the observation will include the tag: jdbc.generated-keys=100.
Previously, the instrumented DataSource was a ProxyDataSource instance.
From this version onward, it returns a pure JDK proxy object.
This behavior can be controlled via the property: jdbc.datasource-proxy.type.
The datasource name is now available as a low-cardinality key under jdbc.datasource.name.
- Tested with Spring Boot 3.4 and 3.5 (M2); should work with prior versions.
- Micrometer: No known compatibility issues with previous versions.