Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a33f3fe
feat(jdbc): basic OpenTelemetry tracing integration for BigQuery JDBC…
keshavdandeva Apr 23, 2026
c7131f9
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva Apr 23, 2026
57a0207
feat(bqjdbc): extend OpenTelemetry instrumentation for metadata and p…
keshavdandeva Apr 28, 2026
20bb4f9
test(bqjdbc): add unit tests for OTel tracing (#12943)
keshavdandeva Apr 29, 2026
e086579
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva Apr 29, 2026
6a80dee
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva Apr 29, 2026
ba40e4c
chore: fix lint
keshavdandeva Apr 29, 2026
91f008b
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva Apr 29, 2026
c1a3123
fix: merge conflicts
keshavdandeva Apr 29, 2026
e93f00b
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva May 4, 2026
077ec28
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva May 4, 2026
919183a
chore: fix merge conflicts
keshavdandeva May 4, 2026
1adc224
feat(bqjdbc): Implement Correlated OpenTelemetry Logging Bridge (#13002)
keshavdandeva May 7, 2026
22682ef
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva May 7, 2026
6d83984
fix: lint
keshavdandeva May 7, 2026
2805455
chore: fix tests regarding BigQueryJdbcMdc.registerInstance()
keshavdandeva May 7, 2026
c4efa0f
feat(bqjdbc): implement OTel SDK and exporting traces and logs to gcp…
keshavdandeva May 13, 2026
e5996c4
Merge branch 'origin/main' into jdbc/otel-sdk-and-export-traces-impl
keshavdandeva May 13, 2026
27ed8de
feat(bqjdbc): Complete OpenTelemetry instrumentation and context prop…
keshavdandeva May 19, 2026
22b18b1
Merge remote-tracking branch 'origin/main' into jdbc/feature-branch-otel
logachev May 22, 2026
6176a4a
Merge remote-tracking branch 'origin/main' into jdbc/feature-branch-otel
logachev May 22, 2026
a0312c7
fix: lint
keshavdandeva May 22, 2026
b6d8f63
test(bigquery-jdbc): add e2e otel test and code refinements (#13226)
keshavdandeva May 28, 2026
568c616
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva May 28, 2026
051c352
chore(bigquery-jdbc): link OpenTelemetry instrumentation with underly…
keshavdandeva May 29, 2026
8bc5ce1
fix(bigquery-jdbc): feature branch failing tests (#13287)
keshavdandeva May 29, 2026
67b84ef
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva May 29, 2026
bde32cf
Merge branch 'main' into jdbc/feature-branch-otel
keshavdandeva Jun 1, 2026
6cb06cf
chore: lint
keshavdandeva Jun 1, 2026
a4a8dc0
feat(bigquery-jdbc): support custom OTel credentials and dynamic toke…
keshavdandeva Jun 5, 2026
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
82 changes: 82 additions & 0 deletions java-bigquery-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
<ignoredUsedUndeclaredDependency>org.apache.httpcomponents.*:*</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>io.grpc:*</ignoredUsedUndeclaredDependency>
</ignoredUsedUndeclaredDependencies>
<ignoredUnusedDeclaredDependencies>
<ignoredUnusedDeclaredDependency>io.opentelemetry.contrib:opentelemetry-gcp-auth-extension</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>io.opentelemetry:opentelemetry-exporter-otlp</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -167,6 +171,17 @@
<relocation>
<pattern>io.opentelemetry</pattern>
<shadedPattern>com.google.bqjdbc.shaded.io.opentelemetry</shadedPattern>
<excludes>
<!--
OpenTelemetry API and Context must remain unshaded to ensure interoperability.
Shading these would prevent the driver from participating in the application's
existing tracing context. We are aware that unshaded dependencies can lead to
version mismatches, but this is a necessary trade-off for the OpenTelemetry
integration to function correctly across different applications.
-->
<exclude>io.opentelemetry.api.*</exclude>
<exclude>io.opentelemetry.context.*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>io.perfmark</pattern>
Expand Down Expand Up @@ -217,6 +232,11 @@
<artifactId>google-cloud-bigquerystorage</artifactId>
<version>3.29.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-bigquerystorage:current} -->
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-logging</artifactId>
<version>3.32.0</version><!-- {x-version-update:google-cloud-logging:current} -->
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-apache-v5</artifactId>
Expand Down Expand Up @@ -304,6 +324,16 @@
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-opentelemetry</artifactId>
<exclusions>
<exclusion>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.arrow</groupId>
Expand All @@ -322,6 +352,42 @@
<artifactId>httpcore5</artifactId>
</dependency>

<!-- OpenTelemetry APIs (unshaded) -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
</dependency>
<!-- OpenTelemetry SDK and Exporters (will be shaded via existing 'io' relocation) -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-gcp-auth-extension</artifactId>
<version>1.56.0-alpha</version>
</dependency>

<!-- Test Dependencies -->

<dependency>
Expand Down Expand Up @@ -371,6 +437,22 @@
<artifactId>junit-platform-suite-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-testing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-logs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-trace</artifactId>
<version>2.92.0</version><!-- {x-version-update:google-cloud-trace:current} -->
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.cloud.bigquery.exception.BigQueryJdbcRuntimeException;
import com.google.cloud.bigquery.storage.v1.ArrowRecordBatch;
import com.google.cloud.bigquery.storage.v1.ArrowSchema;
import io.opentelemetry.context.Scope;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Date;
Expand Down Expand Up @@ -236,29 +237,31 @@ public boolean next() throws SQLException {
|| this.currentBatchRowIndex == (this.vectorSchemaRoot.getRowCount() - 1)) {
/* Start of iteration or we have exhausted the current batch */
// Advance the cursor. Potentially blocking operation.
BigQueryArrowBatchWrapper batchWrapper = this.buffer.take();
if (batchWrapper.getException() != null) {
throw new BigQueryJdbcRuntimeException(batchWrapper.getException());
}
if (batchWrapper.isLast()) {
/* Marks the end of the records */
if (this.vectorSchemaRoot != null) {
// IMP: To avoid memory leak: clear vectorSchemaRoot as it still holds
// the last batch
this.vectorSchemaRoot.clear();
try (Scope scope = makeOriginalContextCurrent()) {
BigQueryArrowBatchWrapper batchWrapper = this.buffer.take();
if (batchWrapper.getException() != null) {
throw new BigQueryJdbcRuntimeException(batchWrapper.getException());
}
if (batchWrapper.isLast()) {
/* Marks the end of the records */
if (this.vectorSchemaRoot != null) {
// IMP: To avoid memory leak: clear vectorSchemaRoot as it still holds
// the last batch
this.vectorSchemaRoot.clear();
}
this.hasReachedEnd = true;
this.rowCount++;
return false;
}
this.hasReachedEnd = true;
// Valid batch, process it
ArrowRecordBatch arrowBatch = batchWrapper.getCurrentArrowBatch();
// Populates vectorSchemaRoot
this.arrowDeserializer.deserializeArrowBatch(arrowBatch);
// Pointing to the first row in this fresh batch
this.currentBatchRowIndex = 0;
this.rowCount++;
return false;
return true;
}
// Valid batch, process it
ArrowRecordBatch arrowBatch = batchWrapper.getCurrentArrowBatch();
// Populates vectorSchemaRoot
this.arrowDeserializer.deserializeArrowBatch(arrowBatch);
// Pointing to the first row in this fresh batch
this.currentBatchRowIndex = 0;
this.rowCount++;
return true;
}
// There are rows left in the current batch.
else if (this.currentBatchRowIndex < this.vectorSchemaRoot.getRowCount()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import com.google.cloud.bigquery.exception.BigQueryJdbcCoercionException;
import com.google.cloud.bigquery.exception.BigQueryJdbcCoercionNotFoundException;
import com.google.cloud.bigquery.exception.BigQueryJdbcException;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanContext;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
Expand Down Expand Up @@ -59,6 +63,7 @@ public abstract class BigQueryBaseResultSet extends BigQueryNoOpsResultSet
protected boolean isClosed = false;
protected boolean wasNull = false;
protected final BigQueryTypeCoercer bigQueryTypeCoercer = BigQueryTypeCoercionUtility.INSTANCE;
protected final SpanContext originalSpanContext;

protected BigQueryBaseResultSet(
BigQuery bigQuery, BigQueryStatement statement, Schema schema, boolean isNested) {
Expand All @@ -67,11 +72,16 @@ protected BigQueryBaseResultSet(
this.schema = schema;
this.schemaFieldList = schema != null ? schema.getFields() : null;
this.isNested = isNested;
this.originalSpanContext = Span.current().getSpanContext();
this.LOG =
BigQueryJdbcResultSetLogger.getLogger(
this.getClass(), statement != null ? statement.connectionId : null);
}

protected Scope makeOriginalContextCurrent() {
return Context.current().with(Span.wrap(this.originalSpanContext)).makeCurrent();
}

public QueryStatistics getQueryStatistics() {
if (queryStatistics != null) {
return queryStatistics;
Expand Down
Loading
Loading