-
Notifications
You must be signed in to change notification settings - Fork 1k
Update jdbc doc with connection wrapping disclaimer #14884
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
1177919
d56d942
794a18c
35753ed
11eba34
855fff7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,26 @@ | |
| | `otel.instrumentation.jdbc.statement-sanitizer.enabled` | Boolean | `true` | Enables the DB statement sanitization. | | ||
| | `otel.instrumentation.jdbc.experimental.capture-query-parameters` | Boolean | `false` | Enable the capture of query parameters as span attributes. Enabling this option disables the statement sanitization. <p>WARNING: captured query parameters may contain sensitive information such as passwords, personally identifiable information or protected health info. | | ||
| | `otel.instrumentation.jdbc.experimental.transaction.enabled` | Boolean | `false` | Enables experimental instrumentation to create spans for COMMIT and ROLLBACK operations. | | ||
|
|
||
| ## Connection Pool Unwrapping | ||
|
|
||
| The JDBC instrumentation requires unwrapping pooled connections (via `java.sql.Wrapper`) to | ||
| correctly attribute database operations to the underlying connection and to cache metadata. Most | ||
| connection pools support this by default. | ||
|
|
||
| **Performance issue?** If unwrapping fails, the instrumentation may have degraded performance or | ||
| increased overhead with some JDBC drivers. Metadata extraction may result in database queries on | ||
| every operation (depending on driver implementation and caching behavior) instead of being cached, | ||
| and operations may be attributed to the wrong database connection. To fix, ensure your connection | ||
| pool supports unwrapping: | ||
|
|
||
| **Vibur DBCP example:** | ||
| ```java | ||
| ds.setAllowUnwrapping(true); | ||
| ``` | ||
|
|
||
| **Custom wrappers:** Implement `java.sql.Wrapper` correctly to delegate `isWrapperFor()` and | ||
| `unwrap()` to the underlying connection. | ||
jaydeluca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Failover note:** Cached metadata uses the unwrapped connection object as the key. If your pool | ||
| reuses the same connection object after failover, telemetry may show stale host attributes. | ||
|
||
Uh oh!
There was an error while loading. Please reload this page.