Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Agroal feature: enhanced leak report #18940

Merged
merged 1 commit into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public void onConnectionCreation(Connection connection) {
log.tracev("{0}: Created connection {1}", datasourceName, connection);
}

@Override
public void onConnectionLeak(Connection connection, Thread thread) {
log.infov("{0}: Connection leak of {1}", datasourceName, connection);
}

@Override
public void onConnectionReap(Connection connection) {
log.tracev("{0}: Closing idle connection {1}", datasourceName, connection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public class DataSourceJdbcRuntimeConfig {
@ConfigItem
public Optional<AgroalConnectionFactoryConfiguration.TransactionIsolation> transactionIsolationLevel = Optional.empty();

/**
* Collect and display extra troubleshooting info on leaked connections.
*/
@ConfigItem
public boolean extendedLeakReport;

/**
* When enabled Agroal will be able to produce a warning when a connection is returned
* to the pool without the application having closed all open statements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public boolean isValid(Connection connection) {
if (dataSourceJdbcRuntimeConfig.maxLifetime.isPresent()) {
poolConfiguration.maxLifetime(dataSourceJdbcRuntimeConfig.maxLifetime.get());
}
poolConfiguration.enhancedLeakReport(dataSourceJdbcRuntimeConfig.extendedLeakReport);
}

public DataSourceBuildTimeConfig getDataSourceBuildTimeConfig(String dataSourceName) {
Expand Down