Skip to content

fix(bigquery-jdbc): support custom Clearcut HTTP transport, profile isolation, and non-flushing disable - #15389

Closed
keshavdandeva wants to merge 1 commit into
mainfrom
fix/jdbc-clearcut-transport-lifecycle
Closed

keshavdandeva wants to merge 1 commit into
mainfrom
fix/jdbc-clearcut-transport-lifecycle

Conversation

@keshavdandeva

@keshavdandeva keshavdandeva commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by the focused 3-PR stack: #15394 -> #15395 -> #15396.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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<>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
metricsMap = new ConcurrentHashMap<>();
metricsMap.clear();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant