Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ static String maskPropertyValue(String key, Object value) {
this.reqGoogleDriveScope,
httpTransportFactory,
this.connectionClassName);
BigQueryJdbcDiagnosticTelemetry.initializeOrDisable(
ds, this.proxyProperties, this.credentials);
this.defaultDataset = BigQueryJdbcUrlUtility.parseDefaultDataset(ds.getDefaultDataset());
this.location = ds.getLocation();
this.enableHighThroughputAPI = ds.getEnableHighThroughputAPI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,17 @@ public static BigQueryDriver getRegisteredDriver() throws IllegalStateException
public Connection connect(String url, Properties info) throws SQLException {
LOG.finest("++enter++");
AuthenticationType authType = AuthenticationType.AUTHENTICATION_TYPE_UNSPECIFIED;
String connectionUri = null;
DataSource ds = null;
try {
if (acceptsURL(url)) {
Properties connectInfo = info == null ? new Properties() : (Properties) info.clone();
Object customOpenTelemetryObj = connectInfo.remove("customOpenTelemetry");

String connectionUri =
connectionUri =
BigQueryJdbcUrlUtility.appendPropertiesToURL(
url.substring(5), this.toString(), connectInfo);

String telemetryOptOut =
BigQueryJdbcUrlUtility.parseUriPropertyWithoutValidation(
connectionUri, BigQueryJdbcUrlUtility.ENABLE_DIAGNOSTIC_TELEMETRY_PROPERTY_NAME);

if (telemetryOptOut != null) {
connectInfo.setProperty(
BigQueryJdbcUrlUtility.ENABLE_DIAGNOSTIC_TELEMETRY_PROPERTY_NAME, telemetryOptOut);
}
TelemetryManager.getInstance(connectInfo);

Level logLevel;
String logPath;
boolean ignoredUrlLogPath;
Expand Down Expand Up @@ -199,7 +191,6 @@ public Connection connect(String url, Properties info) throws SQLException {
BigQueryJdbcUrlUtility.LOG_PATH_PROPERTY_NAME,
BigQueryJdbcUrlUtility.ALLOW_URL_LOG_PATH_SYSTEM_PROPERTY);
}
DataSource ds;
try {
ds = DataSource.fromUrl(connectionUri);
} catch (BigQueryJdbcRuntimeException e) {
Expand Down Expand Up @@ -240,12 +231,10 @@ public Connection connect(String url, Properties info) throws SQLException {
return null;
}
} catch (IOException e) {
TelemetryManager.recordConnectionAttempt(
Status.STATUS_ERROR, TelemetryManager.extractErrorCode(e), authType);
BigQueryJdbcDiagnosticTelemetry.recordFailedConnection(connectionUri, ds, authType, e);
throw new BigQueryJdbcException("Failed to establish connection", e);
} catch (Throwable t) {
TelemetryManager.recordConnectionAttempt(
Status.STATUS_ERROR, TelemetryManager.extractErrorCode(t), authType);
BigQueryJdbcDiagnosticTelemetry.recordFailedConnection(connectionUri, ds, authType, t);
throw t;
}
}
Expand Down
Loading
Loading