eric-wang-1990 opened a new pull request, #3896:
URL: https://github.com/apache/arrow-adbc/pull/3896
## Summary
Enable setting trace parent at the statement level for connection pooling
scenarios like Power BI, where multiple queries reuse the same connection but
need different trace IDs for distributed tracing.
## Changes
- **TracingStatement**: Add `_statementTraceParent` field and
`SetTraceParent()` method
- **TracingStatement**: `TraceParent` property now returns statement
override or falls back to connection's trace parent
- **HiveServer2Statement**: Add `SetOption` case for
`AdbcOptions.Telemetry.TraceParent`
- Add comprehensive test coverage for statement-level trace parent
functionality
## Motivation
This brings C# implementation to parity with Go drivers which already
support statement-level trace parent via `SetOption`.
### Power BI Use Case
Power BI uses connection pooling where multiple queries reuse the same
connection. Each Power BI query has its own trace ID for distributed tracing
correlation. Without statement-level trace parent support, all queries from a
pooled connection would share the same trace context, making it impossible to
correlate individual query traces.
With this change, Power BI can:
```csharp
var connection = pool.GetConnection();
// Query 1 with Trace ID A
var stmt1 = connection.CreateStatement();
stmt1.SetOption("adbc.telemetry.trace_parent", powerBiQueryTraceIdA);
stmt1.ExecuteQuery();
// Query 2 with Trace ID B (same connection!)
var stmt2 = connection.CreateStatement();
stmt2.SetOption("adbc.telemetry.trace_parent", powerBiQueryTraceIdB);
stmt2.ExecuteQuery();
```
## Test Plan
Added `CanSetTraceParentOnStatement` test that verifies:
1. Statement inherits connection's trace parent by default
2. Statement can override with its own trace parent via `SetOption`
3. Activities created by the statement use the statement's trace parent
4. Setting trace parent to null falls back to connection's trace parent
All existing tests pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]