Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 5a92ade

Browse files
feat: add trace_id for Read API (#1544)
* feat: add trace_id for Read API PiperOrigin-RevId: 429809867 Source-Link: googleapis/googleapis@6052603 Source-Link: https://github.com/googleapis/googleapis-gen/commit/840dd14c91a0ec66d9bd1a028d01b5fd029ca02e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODQwZGQxNGM5MWEwZWM2NmQ5YmQxYTAyOGQwMWI1ZmQwMjljYTAyZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a70ae45 commit 5a92ade

5 files changed

Lines changed: 291 additions & 39 deletions

File tree

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadClientTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public void createReadSessionTest() throws Exception {
9393
.setReadOptions(ReadSession.TableReadOptions.newBuilder().build())
9494
.addAllStreams(new ArrayList<ReadStream>())
9595
.setEstimatedTotalBytesScanned(452788190)
96+
.setTraceId("traceId-1067401920")
9697
.build();
9798
mockBigQueryRead.addResponse(expectedResponse);
9899

@@ -144,6 +145,7 @@ public void createReadSessionTest2() throws Exception {
144145
.setReadOptions(ReadSession.TableReadOptions.newBuilder().build())
145146
.addAllStreams(new ArrayList<ReadStream>())
146147
.setEstimatedTotalBytesScanned(452788190)
148+
.setTraceId("traceId-1067401920")
147149
.build();
148150
mockBigQueryRead.addResponse(expectedResponse);
149151

proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSession.java

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private ReadSession() {
4242
dataFormat_ = 0;
4343
table_ = "";
4444
streams_ = java.util.Collections.emptyList();
45+
traceId_ = "";
4546
}
4647

4748
@java.lang.Override
@@ -197,6 +198,13 @@ private ReadSession(
197198
estimatedTotalBytesScanned_ = input.readInt64();
198199
break;
199200
}
201+
case 106:
202+
{
203+
java.lang.String s = input.readStringRequireUtf8();
204+
205+
traceId_ = s;
206+
break;
207+
}
200208
default:
201209
{
202210
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
@@ -3187,6 +3195,63 @@ public long getEstimatedTotalBytesScanned() {
31873195
return estimatedTotalBytesScanned_;
31883196
}
31893197

3198+
public static final int TRACE_ID_FIELD_NUMBER = 13;
3199+
private volatile java.lang.Object traceId_;
3200+
/**
3201+
*
3202+
*
3203+
* <pre>
3204+
* Optional. ID set by client to annotate a session identity. This does not need
3205+
* to be strictly unique, but instead the same ID should be used to group
3206+
* logically connected sessions (e.g. All using the same ID for all sessions
3207+
* needed to complete a Spark SQL query is reasonable).
3208+
* Maximum length is 256 bytes.
3209+
* </pre>
3210+
*
3211+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
3212+
*
3213+
* @return The traceId.
3214+
*/
3215+
@java.lang.Override
3216+
public java.lang.String getTraceId() {
3217+
java.lang.Object ref = traceId_;
3218+
if (ref instanceof java.lang.String) {
3219+
return (java.lang.String) ref;
3220+
} else {
3221+
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
3222+
java.lang.String s = bs.toStringUtf8();
3223+
traceId_ = s;
3224+
return s;
3225+
}
3226+
}
3227+
/**
3228+
*
3229+
*
3230+
* <pre>
3231+
* Optional. ID set by client to annotate a session identity. This does not need
3232+
* to be strictly unique, but instead the same ID should be used to group
3233+
* logically connected sessions (e.g. All using the same ID for all sessions
3234+
* needed to complete a Spark SQL query is reasonable).
3235+
* Maximum length is 256 bytes.
3236+
* </pre>
3237+
*
3238+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
3239+
*
3240+
* @return The bytes for traceId.
3241+
*/
3242+
@java.lang.Override
3243+
public com.google.protobuf.ByteString getTraceIdBytes() {
3244+
java.lang.Object ref = traceId_;
3245+
if (ref instanceof java.lang.String) {
3246+
com.google.protobuf.ByteString b =
3247+
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
3248+
traceId_ = b;
3249+
return b;
3250+
} else {
3251+
return (com.google.protobuf.ByteString) ref;
3252+
}
3253+
}
3254+
31903255
private byte memoizedIsInitialized = -1;
31913256

31923257
@java.lang.Override
@@ -3232,6 +3297,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
32323297
if (estimatedTotalBytesScanned_ != 0L) {
32333298
output.writeInt64(12, estimatedTotalBytesScanned_);
32343299
}
3300+
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(traceId_)) {
3301+
com.google.protobuf.GeneratedMessageV3.writeString(output, 13, traceId_);
3302+
}
32353303
unknownFields.writeTo(output);
32363304
}
32373305

@@ -3277,6 +3345,9 @@ public int getSerializedSize() {
32773345
size +=
32783346
com.google.protobuf.CodedOutputStream.computeInt64Size(12, estimatedTotalBytesScanned_);
32793347
}
3348+
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(traceId_)) {
3349+
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, traceId_);
3350+
}
32803351
size += unknownFields.getSerializedSize();
32813352
memoizedSize = size;
32823353
return size;
@@ -3310,6 +3381,7 @@ public boolean equals(final java.lang.Object obj) {
33103381
}
33113382
if (!getStreamsList().equals(other.getStreamsList())) return false;
33123383
if (getEstimatedTotalBytesScanned() != other.getEstimatedTotalBytesScanned()) return false;
3384+
if (!getTraceId().equals(other.getTraceId())) return false;
33133385
if (!getSchemaCase().equals(other.getSchemaCase())) return false;
33143386
switch (schemaCase_) {
33153387
case 4:
@@ -3356,6 +3428,8 @@ public int hashCode() {
33563428
}
33573429
hash = (37 * hash) + ESTIMATED_TOTAL_BYTES_SCANNED_FIELD_NUMBER;
33583430
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getEstimatedTotalBytesScanned());
3431+
hash = (37 * hash) + TRACE_ID_FIELD_NUMBER;
3432+
hash = (53 * hash) + getTraceId().hashCode();
33593433
switch (schemaCase_) {
33603434
case 4:
33613435
hash = (37 * hash) + AVRO_SCHEMA_FIELD_NUMBER;
@@ -3547,6 +3621,8 @@ public Builder clear() {
35473621
}
35483622
estimatedTotalBytesScanned_ = 0L;
35493623

3624+
traceId_ = "";
3625+
35503626
schemaCase_ = 0;
35513627
schema_ = null;
35523628
return this;
@@ -3619,6 +3695,7 @@ public com.google.cloud.bigquery.storage.v1.ReadSession buildPartial() {
36193695
result.streams_ = streamsBuilder_.build();
36203696
}
36213697
result.estimatedTotalBytesScanned_ = estimatedTotalBytesScanned_;
3698+
result.traceId_ = traceId_;
36223699
result.schemaCase_ = schemaCase_;
36233700
onBuilt();
36243701
return result;
@@ -3720,6 +3797,10 @@ public Builder mergeFrom(com.google.cloud.bigquery.storage.v1.ReadSession other)
37203797
if (other.getEstimatedTotalBytesScanned() != 0L) {
37213798
setEstimatedTotalBytesScanned(other.getEstimatedTotalBytesScanned());
37223799
}
3800+
if (!other.getTraceId().isEmpty()) {
3801+
traceId_ = other.traceId_;
3802+
onChanged();
3803+
}
37233804
switch (other.getSchemaCase()) {
37243805
case AVRO_SCHEMA:
37253806
{
@@ -5725,6 +5806,132 @@ public Builder clearEstimatedTotalBytesScanned() {
57255806
return this;
57265807
}
57275808

5809+
private java.lang.Object traceId_ = "";
5810+
/**
5811+
*
5812+
*
5813+
* <pre>
5814+
* Optional. ID set by client to annotate a session identity. This does not need
5815+
* to be strictly unique, but instead the same ID should be used to group
5816+
* logically connected sessions (e.g. All using the same ID for all sessions
5817+
* needed to complete a Spark SQL query is reasonable).
5818+
* Maximum length is 256 bytes.
5819+
* </pre>
5820+
*
5821+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
5822+
*
5823+
* @return The traceId.
5824+
*/
5825+
public java.lang.String getTraceId() {
5826+
java.lang.Object ref = traceId_;
5827+
if (!(ref instanceof java.lang.String)) {
5828+
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
5829+
java.lang.String s = bs.toStringUtf8();
5830+
traceId_ = s;
5831+
return s;
5832+
} else {
5833+
return (java.lang.String) ref;
5834+
}
5835+
}
5836+
/**
5837+
*
5838+
*
5839+
* <pre>
5840+
* Optional. ID set by client to annotate a session identity. This does not need
5841+
* to be strictly unique, but instead the same ID should be used to group
5842+
* logically connected sessions (e.g. All using the same ID for all sessions
5843+
* needed to complete a Spark SQL query is reasonable).
5844+
* Maximum length is 256 bytes.
5845+
* </pre>
5846+
*
5847+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
5848+
*
5849+
* @return The bytes for traceId.
5850+
*/
5851+
public com.google.protobuf.ByteString getTraceIdBytes() {
5852+
java.lang.Object ref = traceId_;
5853+
if (ref instanceof String) {
5854+
com.google.protobuf.ByteString b =
5855+
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
5856+
traceId_ = b;
5857+
return b;
5858+
} else {
5859+
return (com.google.protobuf.ByteString) ref;
5860+
}
5861+
}
5862+
/**
5863+
*
5864+
*
5865+
* <pre>
5866+
* Optional. ID set by client to annotate a session identity. This does not need
5867+
* to be strictly unique, but instead the same ID should be used to group
5868+
* logically connected sessions (e.g. All using the same ID for all sessions
5869+
* needed to complete a Spark SQL query is reasonable).
5870+
* Maximum length is 256 bytes.
5871+
* </pre>
5872+
*
5873+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
5874+
*
5875+
* @param value The traceId to set.
5876+
* @return This builder for chaining.
5877+
*/
5878+
public Builder setTraceId(java.lang.String value) {
5879+
if (value == null) {
5880+
throw new NullPointerException();
5881+
}
5882+
5883+
traceId_ = value;
5884+
onChanged();
5885+
return this;
5886+
}
5887+
/**
5888+
*
5889+
*
5890+
* <pre>
5891+
* Optional. ID set by client to annotate a session identity. This does not need
5892+
* to be strictly unique, but instead the same ID should be used to group
5893+
* logically connected sessions (e.g. All using the same ID for all sessions
5894+
* needed to complete a Spark SQL query is reasonable).
5895+
* Maximum length is 256 bytes.
5896+
* </pre>
5897+
*
5898+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
5899+
*
5900+
* @return This builder for chaining.
5901+
*/
5902+
public Builder clearTraceId() {
5903+
5904+
traceId_ = getDefaultInstance().getTraceId();
5905+
onChanged();
5906+
return this;
5907+
}
5908+
/**
5909+
*
5910+
*
5911+
* <pre>
5912+
* Optional. ID set by client to annotate a session identity. This does not need
5913+
* to be strictly unique, but instead the same ID should be used to group
5914+
* logically connected sessions (e.g. All using the same ID for all sessions
5915+
* needed to complete a Spark SQL query is reasonable).
5916+
* Maximum length is 256 bytes.
5917+
* </pre>
5918+
*
5919+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
5920+
*
5921+
* @param value The bytes for traceId to set.
5922+
* @return This builder for chaining.
5923+
*/
5924+
public Builder setTraceIdBytes(com.google.protobuf.ByteString value) {
5925+
if (value == null) {
5926+
throw new NullPointerException();
5927+
}
5928+
checkByteStringIsUtf8(value);
5929+
5930+
traceId_ = value;
5931+
onChanged();
5932+
return this;
5933+
}
5934+
57285935
@java.lang.Override
57295936
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
57305937
return super.setUnknownFields(unknownFields);

proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSessionOrBuilder.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,5 +418,38 @@ public interface ReadSessionOrBuilder
418418
*/
419419
long getEstimatedTotalBytesScanned();
420420

421+
/**
422+
*
423+
*
424+
* <pre>
425+
* Optional. ID set by client to annotate a session identity. This does not need
426+
* to be strictly unique, but instead the same ID should be used to group
427+
* logically connected sessions (e.g. All using the same ID for all sessions
428+
* needed to complete a Spark SQL query is reasonable).
429+
* Maximum length is 256 bytes.
430+
* </pre>
431+
*
432+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
433+
*
434+
* @return The traceId.
435+
*/
436+
java.lang.String getTraceId();
437+
/**
438+
*
439+
*
440+
* <pre>
441+
* Optional. ID set by client to annotate a session identity. This does not need
442+
* to be strictly unique, but instead the same ID should be used to group
443+
* logically connected sessions (e.g. All using the same ID for all sessions
444+
* needed to complete a Spark SQL query is reasonable).
445+
* Maximum length is 256 bytes.
446+
* </pre>
447+
*
448+
* <code>string trace_id = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
449+
*
450+
* @return The bytes for traceId.
451+
*/
452+
com.google.protobuf.ByteString getTraceIdBytes();
453+
421454
public com.google.cloud.bigquery.storage.v1.ReadSession.SchemaCase getSchemaCase();
422455
}

0 commit comments

Comments
 (0)