diff --git a/java-bigquery-jdbc/pom.xml b/java-bigquery-jdbc/pom.xml
index c3b049c596e4..24bd9b89eec9 100644
--- a/java-bigquery-jdbc/pom.xml
+++ b/java-bigquery-jdbc/pom.xml
@@ -32,7 +32,6 @@
github
google-cloud-bigquery-jdbc
false
- -Djava.net.preferIPv4Stack=true
@@ -48,7 +47,6 @@
maven-surefire-plugin
3.5.2
- @{argLine} ${preferIpv4.test.argLine}
${skipSurefire}
true
@@ -59,7 +57,6 @@
org.apache.maven.plugins
maven-failsafe-plugin
- @{argLine} ${preferIpv4.test.argLine}
true
@@ -480,14 +477,14 @@
org.apache.maven.plugins
maven-surefire-plugin
- @{argLine} ${preferIpv4.test.argLine} --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED
+ --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED
org.apache.maven.plugins
maven-failsafe-plugin
- @{argLine} ${preferIpv4.test.argLine} --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED
+ --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED
diff --git a/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java b/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java
index bee7d08e8607..a4aee6142f40 100644
--- a/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java
+++ b/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java
@@ -1185,6 +1185,7 @@ void removeStatement(Statement statement) {
}
private OpenTelemetry getOpenTelemetryInstance() {
+ BigQueryJdbcOpenTelemetry.ensureGlobalHandlerAttached();
String effectiveProjectId =
(this.gcpTelemetryProjectId != null) ? this.gcpTelemetryProjectId : this.catalog;
diff --git a/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/OpenTelemetryJulHandler.java b/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/OpenTelemetryJulHandler.java
index af5e5278ffb6..79874f7d085a 100644
--- a/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/OpenTelemetryJulHandler.java
+++ b/java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/OpenTelemetryJulHandler.java
@@ -30,6 +30,7 @@
import io.opentelemetry.context.Context;
import java.time.Instant;
import java.util.Collections;
+import java.util.logging.ErrorManager;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -78,7 +79,8 @@ public void publish(LogRecord record) {
publishToOTel(record, connectionId, config.openTelemetry);
}
} catch (Throwable t) {
- // Ignore exceptions to prevent breaking application logging or other handlers
+ Exception ex = (t instanceof Exception) ? (Exception) t : new Exception(t);
+ reportError("Error publishing log to OpenTelemetry/GCP", ex, ErrorManager.WRITE_FAILURE);
}
}
@@ -182,7 +184,7 @@ public void flush() {
try {
config.loggingClient.flush();
} catch (Exception e) {
- // Ignore failures during flush to protect other connections
+ reportError("Error flushing log to OpenTelemetry/GCP", e, ErrorManager.FLUSH_FAILURE);
}
}
}
diff --git a/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITBigQueryJDBCTest.java b/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITBigQueryJDBCTest.java
index ecffb1aa25c9..aa44e64d7438 100644
--- a/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITBigQueryJDBCTest.java
+++ b/java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITBigQueryJDBCTest.java
@@ -36,6 +36,7 @@
import com.google.cloud.bigquery.jdbc.BigQueryConnection;
import com.google.cloud.bigquery.jdbc.BigQueryDriver;
import com.google.cloud.bigquery.jdbc.DataSource;
+import com.google.cloud.bigquery.jdbc.OpenTelemetryJulHandler;
import com.google.common.collect.ImmutableMap;
import java.io.File;
import java.io.IOException;
@@ -2808,8 +2809,10 @@ public void testPerConnectionLoggingE2E() throws SQLException, IOException {
java.util.logging.Logger bqLogger =
java.util.logging.Logger.getLogger("com.google.cloud.bigquery");
for (java.util.logging.Handler h : bqLogger.getHandlers()) {
- h.close();
- bqLogger.removeHandler(h);
+ if (!(h instanceof OpenTelemetryJulHandler)) {
+ h.close();
+ bqLogger.removeHandler(h);
+ }
}
// Verify physical connection-specific log file creation
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 8bdf20ec90e1..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
@@ -45,10 +45,8 @@
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
-import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-@Tag("known_issue") // b/539615312
public class ITOpenTelemetryTest extends ITBase {
private static final String PROJECT_ID = ServiceOptions.getDefaultProjectId();
@@ -309,7 +307,7 @@ private Trace verifyAndFetchTrace(String traceId) throws Exception {
private T pollWithRetry(java.util.concurrent.Callable task) throws InterruptedException {
int attempts = 0;
- int maxAttempts = 24;
+ int maxAttempts = 10;
long delayMs = 10000;
// 10 second wait for GCP to ingest data