Skip to content

Commit 88751ad

Browse files
committed
chore: remove unused code
1 parent 59706e6 commit 88751ad

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public class BigQueryConnection extends BigQueryNoOpsConnection {
142142
String partnerToken;
143143
boolean enableDefaultTelemetryExporter;
144144
OpenTelemetry customOpenTelemetry;
145-
Tracer tracer = OpenTelemetry.noop().getTracer("");
145+
Tracer tracer =
146+
OpenTelemetry.noop().getTracer(BigQueryJdbcOpenTelemetry.INSTRUMENTATION_SCOPE_NAME);
146147

147148
BigQueryConnection(String url) throws IOException {
148149
this(url, DataSource.fromUrl(url));

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryStatement.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ public class BigQueryStatement extends BigQueryNoOpsStatement {
124124
private int fetchSize;
125125
private String scriptQuery;
126126
private Map<String, String> extraLabels = new HashMap<>();
127-
protected Context otelContext = null;
128127

129128
private BigQueryReadClient bigQueryReadClient = null;
130129
private final BigQuery bigQuery;
@@ -1470,7 +1469,13 @@ public int[] executeBatch() throws SQLException {
14701469
}
14711470

14721471
try {
1473-
String combinedQueries = String.join("", this.batchQueries);
1472+
StringBuilder sb = new StringBuilder();
1473+
for (String query : this.batchQueries) {
1474+
sb.append(query);
1475+
}
1476+
String combinedQueries = sb.toString();
1477+
span.setAttribute("db.statement", combinedQueries);
1478+
14741479
QueryJobConfiguration.Builder jobConfiguration = getJobConfig(combinedQueries);
14751480
jobConfiguration.setPriority(QueryJobConfiguration.Priority.BATCH);
14761481
runQuery(combinedQueries, jobConfiguration.build());
@@ -1646,7 +1651,6 @@ private <T> T withTracing(String spanName, TracedOperation<T> operation) throws
16461651
Tracer tracer = getSafeTracer();
16471652
Span span = tracer.spanBuilder(spanName).startSpan();
16481653
try (Scope scope = span.makeCurrent()) {
1649-
this.otelContext = Context.current();
16501654
return operation.run(span);
16511655
} catch (SQLException | RuntimeException ex) {
16521656
span.recordException(ex);
@@ -1657,10 +1661,6 @@ private <T> T withTracing(String spanName, TracedOperation<T> operation) throws
16571661
}
16581662
}
16591663

1660-
/**
1661-
* Gets the OpenTelemetry Context from the statement execution. Used by ResultSet for pagination
1662-
* span context.
1663-
*/
16641664
private Tracer getSafeTracer() {
16651665
if (connection != null) {
16661666
Tracer tracer = connection.getTracer();
@@ -1670,8 +1670,4 @@ private Tracer getSafeTracer() {
16701670
}
16711671
return GlobalOpenTelemetry.getTracer(BigQueryJdbcOpenTelemetry.INSTRUMENTATION_SCOPE_NAME);
16721672
}
1673-
1674-
public Context getOtelContext() {
1675-
return this.otelContext;
1676-
}
16771673
}

0 commit comments

Comments
 (0)