Skip to content
Open
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 @@ -416,7 +416,10 @@ public Job create(JobInfo jobInfo, JobOption... options) {
new Supplier<JobId>() {
@Override
public JobId get() {
return JobId.of();
// Explicitly set the location for a new job when provided in options.
// Otherwise, the job may be created with an incorrect location
// (e.g. in transaction mode outside the US).
return JobId.of().setLocation(getOptions().getLocation());
}
};
return create(jobInfo, idProvider, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,8 @@ public void testCreateJobTelemetry() throws Exception {
"{\"kind\":\"bigquery#job\",\"id\":\""
+ PROJECT_ID
+ ":"
+ LOCATION
+ ":"
+ JOB_ID
+ "\",\"status\":{\"state\":\"DONE\"}}");

Expand All @@ -804,7 +806,7 @@ public void testCreateJobTelemetry() throws Exception {

verifyRequest("POST", "/projects/" + PROJECT_ID + "/jobs");
Map<String, String> attributes = new HashMap<>();
attributes.put("bq.rpc.response.job.id", PROJECT_ID + ":" + JOB_ID);
attributes.put("bq.rpc.response.job.id", PROJECT_ID + ":" + LOCATION + ":" + JOB_ID);
attributes.put("bq.rpc.response.job.status.state", "DONE");
verifySpan(
"com.google.cloud.bigquery.BigQueryRpc.createJob",
Expand Down
Loading