| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request integrates OpenTelemetry tracing and logging into the BigQuery JDBC driver, adding a custom JUL logging handler (OpenTelemetryJulHandler) and updating core connection, statement, and metadata classes to support tracing and context propagation. The review feedback identifies a performance risk from synchronous blocking network calls inside the logging handler's publish method, recommending offloading to a bounded thread pool. Additionally, it highlights a thread-safety issue in ensureGlobalHandlerAttached that could lead to duplicate handlers, suggesting the use of an explicit lock to secure concurrent initialization.
I am having trouble creating individual review comments. Click here to see my feedback.Calling loggingClient.write synchronously inside the publish method of a logging Handler introduces a blocking network call on the application's critical path. This can severely degrade performance, especially when logging is verbose (e.g., at FINE or INFO levels). Consider offloading the log writing to a background bounded thread pool (e.g., ThreadPoolExecutor with a defined maximum size) or queue, or configuring the Logging client with asynchronous batching options.
ReferencesThe ensureGlobalHandlerAttached method is not thread-safe. If multiple connections are initialized concurrently, multiple threads might check logger.getHandlers() simultaneously, find no handler, and both add a new OpenTelemetryJulHandler. This would result in duplicate handlers and duplicate log exports. To protect this shared state while ensuring thread safety and visibility in performance-sensitive code, prefer using an explicit lock over the synchronized keyword.
private static final java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock();
public static void ensureGlobalHandlerAttached() {
lock.lock();
try {
Logger logger = Logger.getLogger(BIGQUERY_NAMESPACE);
boolean present = false;
for (Handler h : logger.getHandlers()) {
if (h instanceof OpenTelemetryJulHandler) {
present = true;
break;
}
}
if (!present) {
logger.addHandler(new OpenTelemetryJulHandler());
}
} finally {
lock.unlock();
}
}
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
b/517498094
This PR fixes dependency analysis failures and flaky test issues identified in the OpenTelemetry integration feature branch.