feat(bigquery-jdbc): add TelemetryManager singleton foundation and exception safeguards - #14048
feat(bigquery-jdbc): add TelemetryManager singleton foundation and exception safeguards#14048Neenu1995 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a thread-safe singleton, TelemetryManager, to manage the lifecycle of client-side diagnostic and usage telemetry in the BigQuery JDBC driver, along with corresponding unit tests and minor .gitignore updates. The review feedback suggests improving the singleton's lifecycle management by introducing a DISABLED_INSTANCE sentinel. This sentinel prevents re-initialization with default settings when telemetry is explicitly disabled, and the feedback includes specific suggestions to update getInstance(), init(), isInitialized(), and closeInstance() to handle this sentinel state correctly.
|
|
ee6ed51 to
a8ff62d
Compare
a8ff62d to
c69b696
Compare
| tools/**/drivers/** | ||
| tools/**/logs/** | ||
| tools/**/*.jfr | ||
| tools/**/odbc/ |
| */ | ||
| static TelemetryManager getInstance() { | ||
| TelemetryManager localRef = instance; | ||
| if (localRef == null) { |
There was a problem hiding this comment.
nit: should we use isInitilized?
|
|
||
| public class TelemetryManagerTest { | ||
|
|
||
| @BeforeEach |
There was a problem hiding this comment.
Why do we need additional cleanup before the test?
| () -> { | ||
| throw new RuntimeException("Simulated telemetry exception"); | ||
| }); | ||
| lineAfterException.set(true); |
There was a problem hiding this comment.
nit: You don't need this. If it raised an exception, test will fail either way.



Introduces the internal package-private
TelemetryManagersingleton hub for PR 7 of the client-side diagnostic telemetry client implementation (b/527947900).volatile) for zero-contention fast-path telemetry checks (getInstance(),init(),closeInstance()).runSafely(Runnable)ensuring telemetry operations never throw or block driver connection/query hotpaths.TelemetryManagerTestcovering singleton initialization contract, double-checked locking, custom configuration overrides, and zero-exception bubbling.