Skip to content

fix(bigquery-jdbc): propagate proxy and SSL TrustStore settings to Clearcut transport - #15396

Open
keshavdandeva wants to merge 7 commits into
fix/jdbc-clearcut-realm-suppressionfrom
fix/jdbc-clearcut-proxy-tls-transport
Open

keshavdandeva wants to merge 7 commits into
fix/jdbc-clearcut-realm-suppressionfrom
fix/jdbc-clearcut-proxy-tls-transport

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

Stacked on #15395.

Summary

Propagates JDBC proxy and SSL TrustStore settings to the Clearcut diagnostic telemetry HTTP transport, shuts down Clearcut's owned HttpTransport on teardown, and enforces transport-profile isolation across established connections without letting failed connects disable healthy telemetry.

Key changes

  • BigQueryJdbcProxyUtility: Consolidates proxy validation into a shared helper (tryParseProxyProperties) and adds createCustomHttpTransport(...) to construct a dedicated HttpTransport with the connection's proxy and SSL TrustStore settings.
  • BigQueryJdbcDiagnosticTelemetry & BigQueryConnection: Passes parsed proxy properties into telemetry initialization, computes a normalized SHA-256 transport profile key from active proxy and TrustStore settings, supplies a custom HttpTransport only when proxy or TrustStore settings are active, and guards failed-connection paths so invalid or raw-URI proxy/TrustStore configurations never fall back to a direct transport.
  • ClearcutTransport, TelemetryBatcher, TelemetryManager: Always owns and shuts down its HttpTransport on close or setup failure, reuses the active manager for matching profiles, disables telemetry globally without flushing when two established connections conflict on transport profile, and marks failed-first-connect managers as provisional so the first established connection can promote or replace them.
  • Tests: Covers proxy validation, normalized profile key equivalence/differentiation, owned transport shutdown, provisional manager promotion/replacement, failed-connect isolation, and end-to-end loopback CONNECT proxy + HTTPS TrustStore uploads.

Decisions made

  • Clearcut always owns its HttpTransport: Direct connections pass a null transport supplier (TelemetryManager constructs its own NetHttpTransport) and proxied/custom-TLS connections receive a dedicated Apache5HttpTransport, removing the need for an ownership flag.
  • Provisional failed-connect lifecycle: A failed connection with a typo'd SSLTrustStore or mismatched transport profile skips recording instead of latching the global kill switch, while an explicit opt-out or suppressed universe still disables globally.
  • Normalized SHA-256 transport profile key: Normalizing proxy host casing, trimming host/port, and resolving default KeyStore type avoids spurious conflicts while avoiding plaintext retention of proxy or TrustStore passwords in memory.
  • Disable on established profile conflict: Because TelemetryManager is a JVM-wide singleton, conflicting transport profiles across established connections disable diagnostic telemetry rather than sending traffic over the wrong proxy or TrustStore.

@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 introduces transport-profile isolation and lifecycle management for diagnostic telemetry in the BigQuery JDBC driver. It adds support for tracking connection-specific proxy and SSL TrustStore configurations, generating unique transport profile keys, and managing provisional telemetry managers to prevent conflicts. The review feedback highlights three main improvement opportunities: adding defensive null checks in computeTransportProfileKey to prevent a potential NullPointerException if proxyProperties or its values are null, using a loop in TelemetryManager.initializeForConnection to re-evaluate concurrent updates to the active instance to avoid redundant telemetry manager creation, and adding a defensive null check in shutdownTransportQuietly to prevent a NullPointerException if httpTransport is null.

This branch has not been deployed

No deployments
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