[PECOBLR-1709] Add SEA metadata operation logging header#1191
Merged
msrathore-db merged 10 commits intodatabricks:mainfrom Feb 27, 2026
Merged
[PECOBLR-1709] Add SEA metadata operation logging header#1191msrathore-db merged 10 commits intodatabricks:mainfrom
msrathore-db merged 10 commits intodatabricks:mainfrom
Conversation
Added metadataOperationType parameter to executeStatement mock calls in testExecuteInsertWithNonRowcountQueryPrefixes and testExecuteInsertWithoutNonRowcountQueryPrefixes tests. Co-Authored-By: Claude (databricks-claude-opus-4-5) <noreply@anthropic.com>
- Create MetadataOperationType enum with constants to replace string literals (GET_CATALOGS, GET_SCHEMAS, GET_TABLES, GET_COLUMNS, GET_FUNCTIONS, GET_PRIMARY_KEYS, GET_CROSS_REFERENCE) - Refactor getHeaders() method using HeaderContext builder pattern to avoid parameter bloat as new headers are added - Update all metadata operations to use enum constants - Add comprehensive tests for enum values and header generation - Verified header X-Databricks-Metadata-Operation-Type is correctly added with enum values for SEA metadata operations Tests passing: - MetadataOperationTypeTest: 15 tests - DatabricksSdkClientTest: 26 tests - DatabricksMetadataSdkClientTest: 44 tests Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace HeaderContext builder pattern with simpler map-based approach
for passing additional HTTP headers. This addresses reviewer feedback
about unnecessary complexity.
Changes:
- Removed HeaderContext class and builder (~50 lines)
- Updated getHeaders() to accept Map<String, String> additionalHeaders
- Simplified call sites to use maps instead of builder pattern
- Metadata operation type header passed via map when needed
- All logging at DEBUG level for production use
Benefits:
- Simpler code: 44 lines net reduction
- More flexible for future headers
- Easier to understand and maintain
- No builder boilerplate
Example usage:
Map<String, String> additionalHeaders = new HashMap<>();
if (metadataOperationType != null) {
additionalHeaders.put(HEADER_METADATA_OPERATION_TYPE,
metadataOperationType.getHeaderValue());
}
req.withHeaders(getHeaders("executeStatement", type, false, additionalHeaders));
All tests passing:
- DatabricksSdkClientTest: 26 tests ✓
- DatabricksMetadataSdkClientTest: 44 tests ✓
- MetadataOperationTypeTest: 15 tests ✓
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
vikrantpuppala
approved these changes
Feb 17, 2026
Collaborator
vikrantpuppala
left a comment
There was a problem hiding this comment.
thanks for the change!
The merge from main brought 9 new DatabricksStatementTest calls to executeStatement() that used the old 6-parameter signature. Added the 7th parameter (metadataOperationType) using any() matcher since these are all non-metadata operations. All 2960 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Description
Add X-Databricks-Sea-Metadata-Operation-Type HTTP header to SEA ExecuteStatement requests for metadata operations. This enables CP-side logs (ELK, usage logs, SHR metrics) to distinguish metadata operations (getTables, getColumns, etc.) from regular SQL queries.
Changes:
GetPrimaryKeys, GetCrossReference
Testing
metadata operations
Additional Notes to the Reviewer
NO_CHANGELOG=true