feat: include writerId as part of trace id#13488
Conversation
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| String fullTraceId = getFullTraceId(clientlibId, this.writerId, traceId); | |
| String fullTraceId = getFullTraceId(clientlibId, writerId, traceId); |
No description provided.