Skip to content

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

Closed
keshavdandeva wants to merge 1 commit into
fix/jdbc-telemetry-v2-3-gapic-cloud-loggingfrom
fix/jdbc-telemetry-v2-4-it-telemetry-alignment
Closed

keshavdandeva wants to merge 1 commit into
fix/jdbc-telemetry-v2-3-gapic-cloud-loggingfrom
fix/jdbc-telemetry-v2-4-it-telemetry-alignment

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

Summary

Aligns ITOpenTelemetryTest verification clients with per-connection universeDomain, HTTP proxy (authenticated and unauthenticated), and SSLTrustStore* settings, and switches its log-reading client to GAPIC LoggingClient.

Key Decisions

  • GAPIC LoggingClient for test log verification: Uses com.google.cloud.logging.v2.LoggingClient with TransportChannelProvider so log verification works through proxies and custom SSLTrustStores alongside TraceServiceClient.
  • Scoped ServiceAccountCredentials with managed HTTP client lifecycle: Uses non-deprecated ServiceAccountCredentials.fromStream (with cloud-platform scope) wrapped in an AutoCloseable holder that always closes the verification CloseableHttpClient when a proxy or TrustStore is configured.
  • Keep @Tag("disable_universe_domain") until verified on a live custom universe: Preserves the tag in this PR until the suite is executed end-to-end against a live custom-universe environment.

Behavior Changes

  • ITOpenTelemetryTest verification clients now honor universeDomain, ProxyHost/ProxyPort/ProxyUid/ProxyPwd, and SSLTrustStore* from connectionUrl without leaking HTTP clients.
  • Log polling uses GAPIC ListLogEntriesRequest with a 24-hour timestamp filter.

@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 programmatically configure proxies and custom SSL TrustStores for verification clients, replacing the previous system-property-based approach. It introduces VerificationCredentials and helper methods to build customized HTTP clients and gRPC transport channel providers, and updates log fetching to use LoggingClient with a time-bounded filter. Feedback suggests failing fast with an IllegalArgumentException if a custom SSL TrustStore is specified but the channel builder is not an instance of NettyChannelBuilder, preventing silent configuration failures.

Comment on lines +563 to +578
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 a custom SSL TrustStore is configured but the builder is not an instance of NettyChannelBuilder, the configuration is silently ignored. This can lead to confusing SSL handshake failures that are difficult to debug. Consider throwing an IllegalArgumentException or failing fast if the builder type is unsupported when a TrustStore is explicitly requested.

              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 IllegalArgumentException(
                      "SSL TrustStore configuration is only supported with NettyChannelBuilder, but got: "
                          + builder.getClass().getName());
                }
              }

@keshavdandeva

Copy link
Copy Markdown
Contributor Author

Superseded by #15374, rebased onto #15373 in the split 5-PR stack (#15361 → #15371 → #15372 → #15373 → #15374).

@keshavdandeva
keshavdandeva deleted the fix/jdbc-telemetry-v2-4-it-telemetry-alignment branch December 2, 2026 00:25
@keshavdandeva
keshavdandeva removed this pull request from stack #15369 December 2, 2026 00:26
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