Skip to content

test(bigquery-jdbc): align ITOpenTelemetryTest with per-connection proxy, TrustStore, and GAPIC Logging - #15348

Open
keshavdandeva wants to merge 1 commit into
fix/jdbc-telemetry-5-sdk-cache-lifecyclefrom
fix/jdbc-telemetry-6-it-telemetry-alignment
Open

keshavdandeva wants to merge 1 commit into
fix/jdbc-telemetry-5-sdk-cache-lifecyclefrom
fix/jdbc-telemetry-6-it-telemetry-alignment

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

Summary

Updates ITOpenTelemetryTest so integration tests verify the driver's per-connection proxy, SSLTrustStore*, and universeDomain propagation directly instead of relying on JVM-wide system properties, and aligns log verification with GAPIC LoggingClient.

Key Decisions

  • Removed JVM-wide proxy system properties: Deleted setUpProxyProperties() / tearDownProxyProperties() (https.proxyHost, http.proxyHost, etc.) because global properties masked whether the driver actually propagated proxy and TrustStore settings to its exporters.
  • Per-client verification transports: Configured explicit TransportChannelProvider (supporting ProxyUid/ProxyPwd and SSLTrustStore*) and per-client Apache5 HTTP transport on verification credentials for both verifyAndFetchLogs(...) and verifyAndFetchTrace(...).
  • Preserved 24-hour log query window: Migrated verifyAndFetchLogs(...) from legacy Logging to GAPIC LoggingClient and added an explicit timestamp >= <24h ago> filter bound (previously added automatically by LoggingImpl).
  • Retained @Tag("disable_universe_domain"): Kept pending a live custom-universe integration test run.

Behavior Changes

  • Integration test harness only; no production code changes.

@keshavdandeva
keshavdandeva requested review from a team as code owners December 1, 2026 19:30

@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 ITOpenTelemetryTest.java to improve proxy and SSL trust store handling during integration testing. It removes global system property modifications, introduces helper methods to build verification credentials and transport channel providers, and migrates log fetching to use LoggingClient with a bounded timestamp filter. The review feedback suggests two key improvements: removing the unused local variable hexSpanId in verifyAndFetchLogs, and failing fast with an exception if an SSL trust store is configured but the channel builder is not an instance of NettyChannelBuilder to prevent silent failures.

Comment on lines 431 to 439
String traceId = null;
String hexSpanId = null;
for (LogEntry entry : entries) {
if (entry.getTrace() != null) {
if (!entry.getTrace().isEmpty()) {
traceId = entry.getTrace();
hexSpanId = entry.getSpanId();
hexSpanId = entry.getSpanId().isEmpty() ? null : entry.getSpanId();
break;
}
}

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.

medium

The local variable hexSpanId is assigned but never read or used anywhere in the method. It can be safely removed to clean up the code.

      String traceId = null;
      for (LogEntry entry : entries) {
        if (!entry.getTrace().isEmpty()) {
          traceId = entry.getTrace();
          break;
        }
      }

Comment on lines +531 to +546
if (sslTrustStorePath != null
&& !sslTrustStorePath.trim().isEmpty()
&& builder instanceof NettyChannelBuilder) {
try {
TrustManagerFactory tmf =
loadTrustManagerFactory(
sslTrustStorePath,
sslTrustStorePassword,
sslTrustStoreType,
sslTrustStoreProvider);
SslContext sslContext = GrpcSslContexts.forClient().trustManager(tmf).build();
((NettyChannelBuilder) builder).sslContext(sslContext);
} catch (IOException | GeneralSecurityException e) {
throw new IllegalStateException("Failed to configure test SSL TrustStore", e);
}
}

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.

medium

If sslTrustStorePath is provided but the builder is not an instance of NettyChannelBuilder (for example, if the classpath uses unshaded Netty or another transport), the trust store configuration is silently skipped. This can lead to hard-to-debug SSL handshake failures. It is safer to fail fast by throwing an IllegalStateException if a trust store is requested but cannot be applied to the channel builder.

              if (sslTrustStorePath != null && !sslTrustStorePath.trim().isEmpty()) {
                if (builder instanceof NettyChannelBuilder) {
                  try {
                    TrustManagerFactory tmf =
                        loadTrustManagerFactory(
                            sslTrustStorePath,
                            sslTrustStorePassword,
                            sslTrustStoreType,
                            sslTrustStoreProvider);
                    SslContext sslContext = GrpcSslContexts.forClient().trustManager(tmf).build();
                    ((NettyChannelBuilder) builder).sslContext(sslContext);
                  } catch (IOException | GeneralSecurityException e) {
                    throw new IllegalStateException("Failed to configure test SSL TrustStore", e);
                  }
                } else {
                  throw new IllegalStateException(
                      "SSL TrustStore configured but the channel builder is not an instance of NettyChannelBuilder: "
                          + builder.getClass().getName());
                }
              }

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