Skip to content

Conversation

@jadewang-db
Copy link
Contributor

@jadewang-db jadewang-db commented Jul 1, 2025

Summary

  • Adds W3C trace context propagation to the Databricks C# driver via HTTP headers
  • Makes trace propagation configurable with options for enablement, header names, and trace state
  • Integrates with existing ADBC tracing infrastructure to support distributed tracing

Details

This PR implements W3C Trace Context (traceparent/tracestate) propagation
for the Databricks C# driver. When distributed tracing is enabled, the
driver now propagates trace context to Databricks servers, enabling
end-to-end request tracing across the distributed system.

Implementation

  • Added TracingDelegatingHandler to inject trace headers into HTTP requests
  • Integrated handler into the existing HTTP pipeline in DatabricksConnection
  • Added configuration options:
    • adbc.databricks.trace_propagation.enabled (default: true)
    • adbc.databricks.trace_propagation.header_name (default: "traceparent")
    • adbc.databricks.trace_propagation.state_enabled (default: false)

Behavior

  1. If Activity.Current exists, uses its trace context
  2. Falls back to trace parent from connection options (adbc.telemetry.trace_parent)
  3. Optionally includes trace state header when enabled
  4. Supports custom header names for compatibility with different systems

Test plan

  • Added comprehensive unit tests for TracingDelegatingHandler
  • Added tests for configuration parsing in DatabricksConnectionTest
  • Verified trace header propagation with mock HTTP handlers
  • Tested with and without active activities
  • Tested custom header names and trace state propagation
  • Manual testing with actual Databricks instance

…n support

## Summary
  - Adds W3C trace context propagation to the Databricks C# driver via HTTP
  headers
  - Makes trace propagation configurable with options for enablement, header
   names, and trace state
  - Integrates with existing ADBC tracing infrastructure to support
  distributed tracing

  ## Details
  This PR implements W3C Trace Context (traceparent/tracestate) propagation
  for the Databricks C# driver. When distributed tracing is enabled, the
  driver now propagates trace context to Databricks servers, enabling
  end-to-end request tracing across the distributed system.

  ### Implementation
  - Added `TracingDelegatingHandler` to inject trace headers into HTTP
  requests
  - Integrated handler into the existing HTTP pipeline in
  `DatabricksConnection`
  - Added configuration options:
    - `adbc.databricks.trace_propagation.enabled` (default: true)
    - `adbc.databricks.trace_propagation.header_name` (default:
  "traceparent")
    - `adbc.databricks.trace_propagation.state_enabled` (default: false)

  ### Behavior
  1. If `Activity.Current` exists, uses its trace context
  2. Falls back to trace parent from connection options
  (`adbc.telemetry.trace_parent`)
  3. Optionally includes trace state header when enabled
  4. Supports custom header names for compatibility with different systems

  ## Test plan
  - [x] Added comprehensive unit tests for `TracingDelegatingHandler`
  - [x] Added tests for configuration parsing in `DatabricksConnectionTest`
  - [x] Verified trace header propagation with mock HTTP handlers
  - [x] Tested with and without active activities
  - [x] Tested custom header names and trace state propagation
  - [ ] Manual testing with actual Databricks instance
@github-actions github-actions bot added this to the ADBC Libraries 19 milestone Jul 1, 2025
@jadewang-db jadewang-db changed the title feat(csharp/src/Drivers/Databricks): Add W3C trace context propagatio… feat(csharp/src/Drivers/Databricks): Add W3C trace context Jul 1, 2025
Copy link
Contributor

@CurtHagenlocher CurtHagenlocher left a comment

Choose a reason for hiding this comment

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

Thanks!

@CurtHagenlocher CurtHagenlocher merged commit 1b04fca into apache:main Jul 3, 2025
7 checks passed
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.

3 participants