Repository navigation
fix(bigquery-jdbc): support custom Clearcut HTTP transport, profile isolation, and non-flushing disable - #15389
keshavdandeva wants to merge 1 commit into
Conversation
…solation, and non-flushing disable
There was a problem hiding this comment.
Code Review
This pull request refactors the telemetry management system to support custom HTTP transport profiles, allowing better control over transport ownership and lifecycle management. Key changes include implementing AutoCloseable in ClearcutTransport, updating TelemetryBatcher to support closing without flushing, adding a toBuilder() method to TelemetryConfiguration, and refactoring TelemetryManager to manage instances based on transport profiles. A high-severity issue was identified in TelemetryBatcher where reassigning metricsMap to a new map instance can cause compilation or thread-safety issues; using metricsMap.clear() is recommended instead.
| if (flush) { | ||
| flushed = flushOnClose(); | ||
| } else { | ||
| metricsMap = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Reassigning metricsMap to a new ConcurrentHashMap will fail to compile if metricsMap is declared as final (which is standard for such fields). Even if it is not final, reassigning the reference can lead to thread-safety and visibility issues if other threads are concurrently accessing the batcher. Using metricsMap.clear() is a safer, cleaner, and more idiomatic way to discard all buffered metrics.
| metricsMap = new ConcurrentHashMap<>(); | |
| metricsMap.clear(); |
Superseded by the focused 3-PR stack: #15394 -> #15395 -> #15396.