Skip to content

feat: include writerId as part of trace id#13488

Open
agrawal-siddharth wants to merge 1 commit into
googleapis:mainfrom
agrawal-siddharth:writerid
Open

feat: include writerId as part of trace id#13488
agrawal-siddharth wants to merge 1 commit into
googleapis:mainfrom
agrawal-siddharth:writerid

Conversation

@agrawal-siddharth

Copy link
Copy Markdown
Contributor

No description provided.

@agrawal-siddharth agrawal-siddharth requested review from a team as code owners June 15, 2026 22:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors trace ID generation in the BigQuery Storage write client by passing the individual clientId and traceId components to ConnectionWorker instead of pre-constructing the full trace ID in StreamWriter. This allows ConnectionWorker to dynamically build the full trace ID using the writerId and client library version. A critical issue was identified in the ConnectionWorker constructor where this.writerId is referenced before it is initialized; using the local writerId variable instead will prevent potential null pointer or uninitialized field issues.

this.maxInflightBytes = maxInflightBytes;
this.limitExceededBehavior = limitExceededBehavior;
this.traceId = traceId;
String fullTraceId = getFullTraceId(clientlibId, this.writerId, traceId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In the constructor, writerId is available as a local variable (as seen in the TelemetryMetrics constructor call on line 663). Using this.writerId here might refer to an uninitialized field (which would be null) if the field assignment this.writerId = writerId; has not occurred yet. Please use the local variable writerId instead of this.writerId to ensure the correct value is used.

Suggested change
String fullTraceId = getFullTraceId(clientlibId, this.writerId, traceId);
String fullTraceId = getFullTraceId(clientlibId, writerId, traceId);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants