Skip to content

Wire telemetry into DatabricksConnection lifecycle\n\nTask ID: task-7.1-databricks-connection-integration#307

Draft
jadewang-db wants to merge 30 commits intomainfrom
stack/itr5-pr-connection-integration
Draft

Wire telemetry into DatabricksConnection lifecycle\n\nTask ID: task-7.1-databricks-connection-integration#307
jadewang-db wants to merge 30 commits intomainfrom
stack/itr5-pr-connection-integration

Conversation

@jadewang-db
Copy link
Collaborator

@jadewang-db jadewang-db commented Mar 5, 2026

🥞 Stacked PR

Use this link to review incremental changes.


What's Changed

Please fill in a description of the changes here.

This contains breaking changes.

Closes #NNN.

GetEndpointUrl now ensures the host has a scheme prefix before
constructing the telemetry endpoint URL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use JsonFormatter with PreserveProtoFieldNames(true) instead of
JsonFormatter.Default to produce snake_case field names (session_id,
system_configuration, etc.) matching the JDBC driver and proto schema.
Default produces camelCase (sessionId) which is incorrect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Jade Wang and others added 5 commits March 5, 2026 23:34
This file was accidentally committed and should not be tracked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jadewang-db jadewang-db force-pushed the stack/itr5-pr-connection-integration branch from 64758ff to cefa489 Compare March 5, 2026 23:38
Jade Wang and others added 5 commits March 5, 2026 23:49
- Fix final flush no-op by using _closing flag before _disposed
- Drain all batches in FlushAsync instead of just one
- Fix race condition in TelemetryClientManager with lock-based synchronization
- Replace Debug.WriteLine with Activity.Current?.AddEvent() for tracing
- Change TelemetrySessionContext setters to internal
- Use Interlocked counter for queue size instead of ConcurrentQueue.Count
- Use blocking wait in FlushAsync during close
- Use test-isolated TelemetryClientManager instances with proper cleanup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jadewang-db jadewang-db force-pushed the stack/itr5-pr-connection-integration branch from cefa489 to da4ab14 Compare March 5, 2026 23:53
Jade Wang and others added 13 commits March 6, 2026 00:25
…metryMetric

These are no longer used. TelemetryClient now uses a direct
enqueue → flush → export pipeline without the Activity-based
aggregation layer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…\nTask ID: task-5.1-telemetry-client-implementation
Remove ActivityListener and MetricsAggregator dependencies. TelemetryClient
now directly enqueues TelemetryFrontendLog objects and flushes them via
the circuit breaker-protected exporter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
StatementTelemetryContext is now created and populated during
DatabricksStatement.ExecuteQuery(), with telemetry logs emitted
to the TelemetryClient on completion. TelemetryClient.Enqueue()
is no longer a no-op — it queues logs and exports via the
circuit-breaker-protected exporter pipeline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fill in remaining TelemetrySessionContext fields: DriverSystemConfiguration
(driver version, OS, runtime, locale), DriverConnectionParameters (HTTP path,
mode, host), and IsCompressed flag on StatementTelemetryContext.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Split OsName/OsVersion to match JDBC (was combined OSDescription)
- Add CharSetEncoding and ProcessName to SystemConfiguration
- Add AuthMech (PAT/OAuth) and AuthFlow to DriverConnectionParams
- Format HostUrl as "https://host:443" to match JDBC format
- Set Port=0 to match JDBC convention

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Override ExecuteQueryAsync in DatabricksStatement to emit telemetry
(previously only ExecuteQuery was hooked up).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CreateTelemetryHttpClient was creating a plain HttpClient without auth,
causing 401 Unauthorized on /telemetry-ext. Now uses the same handler
pipeline as feature flag client (PAT, OAuth, WIF, proxy support).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hook up telemetry for all four statement execution paths:
ExecuteQuery, ExecuteQueryAsync, ExecuteUpdate, ExecuteUpdateAsync.
Refactor to extract shared helpers (CreateTelemetryContext, RecordSuccess,
RecordError) to reduce duplication across the four overrides.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract sql_statement_id from DatabricksCompositeReader's response
OperationHandle after query execution. Expose StatementId property
on DatabricksCompositeReader for telemetry context to read.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of exposing StatementId on DatabricksCompositeReader, capture it
on DatabricksStatement.LastStatementId in DatabricksConnection.NewReader()
which already has access to both the statement and response objects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jadewang-db jadewang-db force-pushed the stack/itr5-pr-connection-integration branch from da4ab14 to 529700e Compare March 6, 2026 00:26
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.

1 participant