feat(csharp/src/Drivers/Databricks): Add minimal Activity-based logging to RetryHttpHandler#3618
Open
msrathore-db wants to merge 7 commits intoapache:mainfrom
Open
feat(csharp/src/Drivers/Databricks): Add minimal Activity-based logging to RetryHttpHandler#3618msrathore-db wants to merge 7 commits intoapache:mainfrom
msrathore-db wants to merge 7 commits intoapache:mainfrom
Conversation
jadewang-db
approved these changes
Oct 29, 2025
Contributor
eric-wang-1990
left a comment
There was a problem hiding this comment.
Have you tested this E2E with PowerBI?
I am actually not sure if this can be logged correctly, I wonder if you need to do similar things of CloudFetchDownlader which is to propagate the top level Trace function:
Can you test it with latest PBI desktop and see if you can see your logs.
Address reviewer feedback by implementing proper Activity tracing infrastructure following the CloudFetchDownloader pattern. Changes: - RetryHttpHandler now implements IActivityTracer interface - Accepts IActivityTracer parameter to delegate to connection's trace - Wraps retry logic in TraceActivityAsync for proper Activity creation - DatabricksConnection passes 'this' to RetryHttpHandler constructor - Updated all unit tests with MockActivityTracer This ensures Activity-based logging works reliably in client scenarios like PowerBI Desktop by properly propagating trace context through the handler chain, rather than relying on Activity.Current which may be null. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Activity-based logging to
RetryHttpHandler.csfor improved observability of HTTP retry behavior.Changes
Architecture: Activity Propagation
The handler implements the
IActivityTracerpattern for proper trace context propagation:IActivityTracerinterface - Delegates trace operations to the connectionIActivityTracerparameter - Connection instance passed in constructorTraceActivityAsyncwrapper - Creates Activities properly for telemetry listenersThis ensures Activity context flows correctly through the HTTP handler chain, following the same pattern as
CloudFetchDownloader.Logging Strategy
What Gets Logged
Tags (When Retries Occur):
http.retry.attempt- Current attempt number (logged per retry)http.retry.total_attempts- Total number of retry attemptshttp.response.status_code- HTTP status codehttp.retry.outcome- Only for failures:cancelledortimeout_exceededException Context (On Failures):
error.context- Failure reason (http.retry.cancelledorhttp.retry.timeout_exceeded)attempts- Number of attempts madetotal_retry_seconds/timeout_seconds- Timing information (timeout cases only)Retryable Status Codes: 408, 502, 503, 504
Example Log Output
Success (No Retries):
// NO LOGGING - Most efficient pathSuccess After Retries:
{ "Tags": { "http.retry.attempt": 1, "http.response.status_code": 503, "http.retry.attempt": 2, "http.response.status_code": 503, "http.retry.total_attempts": 2, "http.response.status_code": 200 } }Timeout Exceeded:
{ "Tags": { "http.retry.total_attempts": 3, "http.response.status_code": 503, "http.retry.outcome": "timeout_exceeded" }, "Exception": { "error.context": "http.retry.timeout_exceeded", "attempts": 3, "total_retry_seconds": 7, "timeout_seconds": 30 } }Testing
IActivityTracerimplementationCloudFetchDownloader(proven in production)Breaking Changes
None. Additive logging only.