Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2690c44
feat(bigquery-jdbc): configure protobuf plugin and add clientanalytic…
Neenu1995 Jul 2, 2026
c5e4835
Merge branch 'jdbc-telemetry-feature' of github.com:googleapis/google…
Neenu1995 Jul 3, 2026
c1cb7ce
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 6, 2026
44598bf
feat(bigquery-jdbc): add telemetry proto schema definition (#13651)
Neenu1995 Jul 6, 2026
a4fa21f
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 8, 2026
1ae622f
feat(bigquery-jdbc): add telemetry configuration class (#13710)
Neenu1995 Jul 9, 2026
fd23296
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 9, 2026
7f49edd
feat(bigquery-jdbc): implement driver environment builder (#13723)
Neenu1995 Jul 10, 2026
fd9ff3a
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 10, 2026
8a79ad8
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 13, 2026
5b46669
feat(bigquery-jdbc): implement clearcut transport layer (#13738)
Neenu1995 Jul 14, 2026
92e90b0
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 14, 2026
9185b6c
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Jul 28, 2026
47605a1
feat(bigquery-jdbc): implement non-blocking telemetry batcher and dis…
Neenu1995 Jul 30, 2026
f9ddada
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 7, 2026
dbeb929
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 11, 2026
13051d9
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 12, 2026
a887ec3
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 14, 2026
12cc8d6
feat(bigquery-jdbc): add TelemetryManager singleton foundation and ex…
Neenu1995 Aug 14, 2026
1aaf6ff
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 17, 2026
05aa492
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 24, 2026
4ad172b
doc(bigquery-jdbc): add Client side telemetry to README (#14168)
Neenu1995 Aug 24, 2026
3499e4b
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Aug 25, 2026
919d341
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 1, 2026
6d42eed
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 3, 2026
793b4d3
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 9, 2026
bf7fe79
feat(bigquery-jdbc): add opt-out controls (#14199)
Neenu1995 Sep 11, 2026
6fede33
feat(bigquery-jdbc): add aggregation logic (#14202)
Neenu1995 Sep 12, 2026
2d2447f
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 12, 2026
7a2139c
Merge branch 'jdbc-telemetry-feature' of github.com:googleapis/google…
Neenu1995 Sep 12, 2026
01fe781
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 14, 2026
8ab176f
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 15, 2026
e608dc6
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 16, 2026
0ae90d5
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 18, 2026
929a424
feat(bigquery-jdbc): record Statement execution and ConnectionAttempt…
Neenu1995 Sep 18, 2026
e6005a0
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 18, 2026
be6ec46
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 24, 2026
aa260e2
feat(bigquery-jdbc): record errors and flush on batchSizeThreshold (#…
Neenu1995 Sep 28, 2026
c08f1fb
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Sep 28, 2026
e0b6f12
fix(bigquery-jdbc): set a shorter close timeout (#14534)
Neenu1995 Sep 29, 2026
05a4b5d
merge main
Neenu1995 Sep 29, 2026
ad7b26b
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Oct 5, 2026
afcf3f8
update branch
Neenu1995 Oct 5, 2026
d9ec8db
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Oct 6, 2026
b78e216
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Oct 8, 2026
0780724
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Oct 13, 2026
dfca103
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Oct 13, 2026
fea68c8
remove stray test class
Neenu1995 Oct 14, 2026
62e3c21
Merge branch 'main' into jdbc-telemetry-feature
Neenu1995 Oct 14, 2026
9f67bdc
Merge branch 'jdbc-telemetry-feature' of github.com:googleapis/google…
Neenu1995 Oct 14, 2026
9a466f4
resolve conflicts
Neenu1995 Oct 15, 2026
384f63d
fail silently for SecurityException
Neenu1995 Oct 15, 2026
276b475
fix build
Neenu1995 Oct 16, 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
2 changes: 2 additions & 0 deletions java-bigquery-jdbc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ tools/**/*.class
tools/**/drivers/**
tools/**/logs/**
tools/**/*.jfr
tools/**/odbc/
tools/**/native_odbc_perf

# Gemini/Jetski agent custom skills
.agents/
58 changes: 58 additions & 0 deletions java-bigquery-jdbc/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,64 @@ See the [Authentication][authentication] section in the base directory's README.

The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired BigQuery JDBC APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the BigQuery JDBC API calls.

## Client-side usage telemetry

The JDBC driver for BigQuery includes client-side telemetry that
automatically collects anonymous usage and diagnostic metrics to help Google
improve driver stability and features. Client-side usage telemetry collection is
designed to run in the background without affecting driver performance or JDBC
functionality. Any telemetry transmission failures fail silently and don't
surface errors to the application or incur any cost.

Client-side usage telemetry never collects SQL query text, parameter values,
database schema information, or data contents. Telemetry collection doesn't work
in environments using custom endpoint URLs or restricted network access that
blocks outbound connections to Google's public logging services.

### Collected diagnostics

The driver collects the following information:

* Environment information: The Driver version, JVM major version, operating
system platform and version, and an anonymous device correlation ID stored
locally in the `~/.bigquery-jdbc/telemetry-tag` folder.
* Connection metrics: Connection outcome status (success, failure, or
cancellation) and authentication method used (such as service account, ADC,
or token).
* Execution metrics: High-level query operation types (such as `SELECT`,
INSERT, and CREATE TABLE), execution engine substrate used (standard REST API
or high-throughput API), and duration latency distributions.
* Error and feature metrics: Internal exception codes, origin methods, and
feature usage counters (such as prepared statements, batching, and connection
pooling).

<a id="telemetry-configuration"></a>
### Client-side usage telemetry configuration

Client-side usage telemetry behaves as a global background service for
the application's JVM. Settings can be configured using JDBC connection
properties, environment variables, or Java system properties. The driver
resolves settings in the following priority: system property > environment
variable > JDBC connection property.

Due to its global nature, client-side usage telemetry connection properties
exhibit the following lifecycle behaviors:

* Opt-Out Control: If client-side usage telemetry is disabled at any point using
a connection property (`EnableDiagnosticTelemetry=0`), environment variable,
or system property, the service immediately shuts down and remains permanently
off for the remainder of the JVM lifecycle. It will only restart when
the JVM restarts.

#### Configuration Keys

To configure these properties, you can use the following keys:

* Opt-Out Control:
* Connection Property: `EnableDiagnosticTelemetry=0;`
* Environment Variable: `BIGQUERY_JDBC_TELEMETRY_ENABLED=false`
* System Property: `-DBIGQUERY_JDBC_TELEMETRY_ENABLED=false`

## Developer Guide

### Prerequisites
Expand Down
24 changes: 24 additions & 0 deletions java-bigquery-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
</properties>

<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.1</version>
</extension>
</extensions>
<resources>
<resource>
<directory>src/main/resources</directory>
Expand Down Expand Up @@ -225,6 +232,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}</protocArtifact>
<checkStaleness>true</checkStaleness>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
public class BigQueryConversionException extends SQLException {

public BigQueryConversionException(String message, Throwable cause) {
super(BigQueryJdbcExceptionUtils.formatMessage(message, cause), cause);
super(
BigQueryJdbcExceptionUtils.formatMessage(message, cause),
BigQueryJdbcSqlStates.DATA_EXCEPTION,
cause);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class BigQueryJdbcException extends SQLException {
* @param message The detail message.
*/
public BigQueryJdbcException(String message) {
super(message);
super(message, BigQueryJdbcSqlStates.GENERAL_ERROR);
}

/**
Expand All @@ -37,7 +37,7 @@ public BigQueryJdbcException(String message) {
* @param ex The InterruptedException to be thrown.
*/
public BigQueryJdbcException(InterruptedException ex) {
super(ex);
super(ex.getMessage(), BigQueryJdbcSqlStates.QUERY_CANCELED, ex);
}

/**
Expand All @@ -47,7 +47,10 @@ public BigQueryJdbcException(InterruptedException ex) {
* @param ex The BigQueryException to be thrown.
*/
public BigQueryJdbcException(String message, BigQueryException ex) {
super(BigQueryJdbcExceptionUtils.formatMessage(message, ex), ex);
super(
BigQueryJdbcExceptionUtils.formatMessage(message, ex),
BigQueryJdbcExceptionUtils.sqlStateForCause(ex),
ex);
this.bigQueryException = ex;
}

Expand All @@ -58,7 +61,10 @@ public BigQueryJdbcException(String message, BigQueryException ex) {
* @param cause Throwable that is being converted.
*/
public BigQueryJdbcException(String message, Throwable cause) {
super(BigQueryJdbcExceptionUtils.formatMessage(message, cause), cause);
super(
BigQueryJdbcExceptionUtils.formatMessage(message, cause),
BigQueryJdbcExceptionUtils.sqlStateForCause(cause),
cause);
}

/**
Expand All @@ -70,13 +76,23 @@ public BigQueryJdbcException(String message, Throwable cause) {
*/
public BigQueryJdbcException(Throwable cause) {
super(
cause instanceof BigQueryJdbcException ? cause.getMessage() : String.valueOf(cause),
cause instanceof SQLException ? ((SQLException) cause).getSQLState() : null,
cause instanceof SQLException ? ((SQLException) cause).getErrorCode() : 0,
cause == null
? null
: (cause instanceof BigQueryJdbcException
? cause.getMessage()
: (cause.getMessage() != null ? cause.getMessage() : cause.toString())),
cause instanceof SQLException && ((SQLException) cause).getSQLState() != null
? ((SQLException) cause).getSQLState()
: BigQueryJdbcExceptionUtils.sqlStateForCause(cause),
cause instanceof SQLException
? ((SQLException) cause).getErrorCode()
: (cause instanceof BigQueryException ? ((BigQueryException) cause).getCode() : 0),
cause instanceof BigQueryJdbcException ? cause.getCause() : cause);
if (cause instanceof BigQueryJdbcException) {
bigQueryException = ((BigQueryJdbcException) cause).bigQueryException;
this.bigQueryException = ((BigQueryJdbcException) cause).bigQueryException;
setStackTrace(cause.getStackTrace());
} else if (cause instanceof BigQueryException) {
this.bigQueryException = (BigQueryException) cause;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.google.cloud.bigquery.exception;

import com.google.cloud.bigquery.BigQueryException;

/** Utility class for JDBC exceptions. */
final class BigQueryJdbcExceptionUtils {

Expand All @@ -37,4 +39,49 @@ public static String formatMessage(String message, Throwable cause) {
? "\n" + (cause.getMessage() != null ? cause.getMessage() : cause.toString())
: "");
}

/**
* Maps a cause to a standard SQL:2003 SQLState.
*
* <p>Returns {@code HY000} (general error) for anything unrecognised, so the result is always a
* valid 5-character state and never null.
*
* @param cause the underlying cause, may be null.
* @return a 5-character SQLState.
*/
static String sqlStateForCause(Throwable cause) {
if (!(cause instanceof BigQueryException)) {
return BigQueryJdbcSqlStates.GENERAL_ERROR;
}
String reason = ((BigQueryException) cause).getReason();
if (reason == null) {
return BigQueryJdbcSqlStates.GENERAL_ERROR;
}
switch (reason) {
case "invalidQuery":
case "invalid":
case "badRequest":
return BigQueryJdbcSqlStates.SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION;
case "accessDenied":
return BigQueryJdbcSqlStates.INSUFFICIENT_PRIVILEGE;
case "invalidUser":
return BigQueryJdbcSqlStates.INVALID_AUTHORIZATION;
case "quotaExceeded":
case "rateLimitExceeded":
case "resourcesExceeded":
return BigQueryJdbcSqlStates.INSUFFICIENT_RESOURCES;
case "responseTooLarge":
return BigQueryJdbcSqlStates.PROGRAM_LIMIT_EXCEEDED;
case "stopped":
return BigQueryJdbcSqlStates.QUERY_CANCELED;
case "backendError":
case "internalError":
case "jobInternalError":
return BigQueryJdbcSqlStates.SYSTEM_ERROR;
case "notImplemented":
return BigQueryJdbcSqlStates.FEATURE_NOT_SUPPORTED;
default:
return BigQueryJdbcSqlStates.GENERAL_ERROR;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class BigQueryJdbcSqlFeatureNotSupportedException extends SQLFeatureNotSu
* @param message The detail message.
*/
public BigQueryJdbcSqlFeatureNotSupportedException(String message) {
super(message);
super(message, BigQueryJdbcSqlStates.FEATURE_NOT_SUPPORTED);
}

/**
Expand All @@ -36,6 +36,6 @@ public BigQueryJdbcSqlFeatureNotSupportedException(String message) {
* @param ex The BigQueryException to be thrown.
*/
public BigQueryJdbcSqlFeatureNotSupportedException(BigQueryException ex) {
super(ex);
super(ex.getMessage(), BigQueryJdbcSqlStates.FEATURE_NOT_SUPPORTED, ex);
}
}
Loading
Loading