feat(csharp/src/Drivers/Databricks): Add Activity-based logging to DatabricksStatement #3617
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 comprehensive Activity-based logging to
DatabricksStatement.csfor improved observability and debugging of Databricks ADBC operations.Changes
Methods with Logging Added
SetStatementProperties: Logs configuration (Arrow native types, CloudFetch settings, async mode)GetSchemaFromMetadata: Logs schema parsing decisions (Arrow vs Thrift, column count)GetCatalogsAsync: Logs catalog queries with feature flags and row countsGetSchemasAsync: Logs schema queries with catalog filteringGetTablesAsync: Logs table queries with SPARK catalog handlingGetColumnsAsync: Logs column queries with search criteriaGetPrimaryKeysAsync: Logs primary key queriesGetCrossReferenceAsync: Logs foreign key queriesGetColumnsExtendedAsync: Logs DESC TABLE EXTENDED queriesSetOption: Logs configuration changesWhat Gets Logged
Tags:
enable_multiple_catalog_support,pk_fk_enabled)db.response.returned_rows)Events:
statement.<operation>.start/statement.<operation>.completecalling_base_implementation,returning_empty_result,fallback_to_base)using_arrow_schema,fallback_to_thrift)Example Log Output
{ "OperationName": "GetCatalogs", "Duration": "00:00:00.582", "TagObjects": { "statement.feature.enable_multiple_catalog_support": true, "db.response.returned_rows": 28 }, "Events": [ { "Name": "statement.get_catalogs.start" }, { "Name": "statement.get_catalogs.calling_base_implementation" }, { "Name": "statement.get_catalogs.complete" } ] }Testing
Tested locally by enabling logging with:
Verified that all tags, events, and distributed tracing context are captured correctly in trace files for all implemented methods (GetCatalogs, GetSchemas, GetTables, GetColumns, and statement configuration).
PR generated by Cursor.