diff --git a/java-bigquery-jdbc/pom.xml b/java-bigquery-jdbc/pom.xml
index 9ea2cfabf539..d4082c679acd 100644
--- a/java-bigquery-jdbc/pom.xml
+++ b/java-bigquery-jdbc/pom.xml
@@ -50,6 +50,7 @@
${skipSurefire}
true
+ true
@@ -59,6 +60,7 @@
true
+ true
diff --git a/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITOpenTelemetryTest.java b/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITOpenTelemetryTest.java
index 1c0e63458f95..444b92fcefc0 100644
--- a/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITOpenTelemetryTest.java
+++ b/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITOpenTelemetryTest.java
@@ -263,9 +263,15 @@ private String verifyAndFetchLogs(String connectionUuid) throws Exception {
List entries = fetchLogsWithRetry(logging, filter);
assertFalse(entries.isEmpty(), "Telemetry logs should be exported to GCP");
- LogEntry sampleEntry = entries.get(0);
- String traceId = sampleEntry.getTrace();
- String hexSpanId = sampleEntry.getSpanId();
+ String traceId = null;
+ String hexSpanId = null;
+ for (LogEntry entry : entries) {
+ if (entry.getTrace() != null) {
+ traceId = entry.getTrace();
+ hexSpanId = entry.getSpanId();
+ break;
+ }
+ }
assertNotNull(traceId, "Log entry must contain TraceId");
assertNotNull(hexSpanId, "Log entry must contain SpanId");