Skip to content

Commit 6437b47

Browse files
committed
fix(bigquery): prevent NullPointerException in OTel tracing when JobId is null
1 parent a577934 commit 6437b47

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ && getOptions().getOpenTelemetryTracer() != null) {
452452
getOptions()
453453
.getOpenTelemetryTracer()
454454
.spanBuilder("com.google.cloud.bigquery.BigQuery.createJob")
455-
.setAllAttributes(jobInfo.getJobId().getOtelAttributes())
455+
.setAllAttributes(jobInfo.getJobId() != null ? jobInfo.getJobId().getOtelAttributes() : null)
456456
.setAllAttributes(otelAttributesFromOptions(options))
457457
.startSpan();
458458
}
@@ -2125,7 +2125,7 @@ && getOptions().getOpenTelemetryTracer() != null) {
21252125
getOptions()
21262126
.getOpenTelemetryTracer()
21272127
.spanBuilder("com.google.cloud.bigquery.BigQuery.getQueryResults")
2128-
.setAllAttributes(jobId.getOtelAttributes())
2128+
.setAllAttributes(jobId != null ? jobId.getOtelAttributes() : null)
21292129
.setAllAttributes(otelAttributesFromOptions(options))
21302130
.startSpan();
21312131
}

0 commit comments

Comments
 (0)