Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions java-bigquery-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<github.global.server>github</github.global.server>
<site.installationModule>google-cloud-bigquery-jdbc</site.installationModule>
<skipShade>false</skipShade>
<preferIpv4.test.argLine>-Djava.net.preferIPv4Stack=true</preferIpv4.test.argLine>
</properties>

<build>
Expand All @@ -48,7 +47,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<argLine>@{argLine} ${preferIpv4.test.argLine}</argLine>
<skip>${skipSurefire}</skip>
<systemPropertyVariables>
<JDBC_TESTS>true</JDBC_TESTS>
Expand All @@ -59,7 +57,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>@{argLine} ${preferIpv4.test.argLine}</argLine>
<systemPropertyVariables>
<JDBC_TESTS>true</JDBC_TESTS>
</systemPropertyVariables>
Expand Down Expand Up @@ -480,14 +477,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} ${preferIpv4.test.argLine} --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
<argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
Comment thread
keshavdandeva marked this conversation as resolved.
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>@{argLine} ${preferIpv4.test.argLine} --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
<argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
Comment thread
keshavdandeva marked this conversation as resolved.
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ void removeStatement(Statement statement) {
}

private OpenTelemetry getOpenTelemetryInstance() {
BigQueryJdbcOpenTelemetry.ensureGlobalHandlerAttached();

String effectiveProjectId =
(this.gcpTelemetryProjectId != null) ? this.gcpTelemetryProjectId : this.catalog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Comment thread
keshavdandeva marked this conversation as resolved.
}

Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -309,7 +307,7 @@ private Trace verifyAndFetchTrace(String traceId) throws Exception {

private <T> T pollWithRetry(java.util.concurrent.Callable<T> task) throws InterruptedException {
int attempts = 0;
int maxAttempts = 24;
int maxAttempts = 10;
long delayMs = 10000;

// 10 second wait for GCP to ingest data
Expand Down
Loading