Skip to content

fix(bigquery-jdbc): propagate universeDomain, proxy, and SSLTrustStore to OpenTelemetry trace export - #15372

Open
keshavdandeva wants to merge 4 commits into
fix/jdbc-telemetry-v2-2a-otel-programmatic-sdkfrom
fix/jdbc-telemetry-v2-2b-otel-universe-proxy-tls
Open

keshavdandeva wants to merge 4 commits into
fix/jdbc-telemetry-v2-2a-otel-programmatic-sdkfrom
fix/jdbc-telemetry-v2-2b-otel-universe-proxy-tls

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

Summary

Propagates per-connection universeDomain, HTTP proxy routing, and custom SSLTrustStore* settings to the driver-owned OpenTelemetry trace exporter, enforces fail-closed credential universe validation, and extends TelemetrySdkCacheKey with universe domain and TrustStore isolation.

Key Decisions

  • Fail-closed universe domain validation: Validates universeDomain syntax and rejects mismatched credential universes at connect time with a checked BigQueryJdbcException before attaching any bearer token. Compute Engine-backed credentials (including impersonated Compute Engine credentials) defer the universe check to the exporter thread to avoid metadata server probes on the connect path, memoizing valid/mismatch outcomes while retrying transient IOExceptions.
  • Unauthenticated proxy forces http/protobuf; authenticated proxy fails fast: OtlpGrpcSpanExporter does not support proxy configuration, so when an unauthenticated proxy is configured the trace exporter switches to OtlpHttpSpanExporter with ProxyOptions. Because OTel ProxyOptions does not support Proxy-Authorization, enabling the built-in trace exporter with ProxyUid/ProxyPwd fails fast with a checked BigQueryJdbcException instructing callers to disable enableGcpTraceExporter, use useGlobalOpenTelemetry=true, or pass a custom OpenTelemetry instance (while log-only configurations remain unaffected).
  • Custom SSLTrustStore* on both HTTP and gRPC exporters: Configures setSslContext(sslContext, trustManager) via BigQueryJdbcProxyUtility.createSslConfig(...) for both OtlpHttpSpanExporter and OtlpGrpcSpanExporter, wrapping load failures as checked BigQueryJdbcException.
  • Cache isolation updated in the same PR: Adds targetUniverseDomain and hashed TrustStore identity (file path + mtime/size + type/provider/password hash) to TelemetrySdkCacheKey.forTrace(...) so connections in different universes or with different/rotated TrustStores never share a cached SDK.

Behavior Changes

  • Driver-owned OTLP trace exporters target https://telemetry.<universeDomain>:443 (gRPC) or https://telemetry.<universeDomain>:443/v1/traces (http/protobuf), defaulting to googleapis.com.
  • Connections with ProxyHost/ProxyPort (unauthenticated) automatically use http/protobuf for trace export even when otel.exporter.otlp.protocol=grpc.
  • Connections with authenticated proxies (ProxyUid/ProxyPwd) and enableGcpTraceExporter=true fail fast with a checked BigQueryJdbcException at connect time.
  • Both HTTP and gRPC OTLP trace exporters honor connection SSLTrustStore* properties, and TelemetrySdkCacheKey isolates cached SDKs across targetUniverseDomain and TrustStore configuration/rotation.

@keshavdandeva
keshavdandeva requested review from a team as code owners December 2, 2026 00:02

@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 support for custom universe domains and SSL TrustStore configurations within the JDBC driver's OpenTelemetry trace exporter. Key changes include the propagation of universe domain and SSL TrustStore properties to the telemetry transport configuration, lazy validation of Compute Engine-backed credential universes on the exporter thread, and isolation of cached SDK instances using these new dimensions in the cache key. Additionally, the driver now explicitly rejects the built-in trace exporter when authenticated HTTP proxies are used. Extensive unit tests have been added to verify these behaviors under various network and credential configurations. No review comments were provided, so there is no feedback to address.

@keshavdandeva
keshavdandeva force-pushed the fix/jdbc-telemetry-v2-2b-otel-universe-proxy-tls branch from b1e477a to 76ff29e Compare December 3, 2026 13:31

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