Skip to content

Commit b10a592

Browse files
committed
feat(telemetry): populate sql_operation, auth_type, and driver_connection_params
Aligns the Node.js telemetry payload with the receiver schema (JDBC parity). Several fields were being collected by the producer/aggregator but dropped on the floor in the exporter: - `sql_operation.operation_detail.operation_type` (CREATE_SESSION / DELETE_SESSION / EXECUTE_STATEMENT / LIST_*) on both connection and statement events. - `sql_operation.is_compressed` on statement events when CloudFetch compression observability is available. - `sql_operation.execution_result` now resolves to `FORMAT_UNSPECIFIED` when result-set metadata isn't available (DDL/DML, or SELECTs closed without fetching), so the `sql_operation` block fires on every statement-complete event instead of being skipped. - Top-level `auth_type` from `DriverConfiguration.authType`. - New `driver_connection_params` block carrying `host_info.host_url`, `http_path`, `enable_arrow`, `enable_direct_results`, `socket_timeout`, `enable_metric_view_metadata`, `cloud_fetch_enabled`, `lz4_enabled`, `retry_max_attempts`, `cloud_fetch_concurrent_downloads`. Both `auth_type` and `driver_connection_params` are gated behind the existing authenticated-export guard (same path as `system_configuration`), since `host_url` and `http_path` are workspace-correlated identifiers that must not ship on the unauthenticated endpoint. Co-authored-by: Isaac
1 parent e200a1b commit b10a592

2 files changed

Lines changed: 53 additions & 3 deletions

File tree

lib/telemetry/DatabricksTelemetryExporter.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,26 @@ interface DatabricksTelemetryLog {
6060
char_set_encoding?: string;
6161
process_name?: string;
6262
};
63+
auth_type?: string;
64+
driver_connection_params?: {
65+
host_info?: { host_url?: string };
66+
http_path?: string;
67+
enable_arrow?: boolean;
68+
enable_direct_results?: boolean;
69+
socket_timeout?: number;
70+
enable_metric_view_metadata?: boolean;
71+
cloud_fetch_enabled?: boolean;
72+
lz4_enabled?: boolean;
73+
retry_max_attempts?: number;
74+
cloud_fetch_concurrent_downloads?: number;
75+
};
6376
operation_latency_ms?: number;
6477
sql_operation?: {
6578
execution_result?: string;
79+
is_compressed?: boolean;
80+
operation_detail?: {
81+
operation_type?: string;
82+
};
6683
chunk_details?: {
6784
total_chunks_present?: number;
6885
total_chunks_iterated?: number;
@@ -368,6 +385,11 @@ export default class DatabricksTelemetryExporter {
368385
if (metric.latencyMs !== undefined) {
369386
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;
370387
}
388+
if (metric.operationType) {
389+
log.entry.sql_driver_log.sql_operation = {
390+
operation_detail: { operation_type: metric.operationType },
391+
};
392+
}
371393
if (metric.driverConfig && includeCorrelation) {
372394
// system_configuration is a high-entropy client fingerprint (OS, arch,
373395
// locale, process, runtime). Only ship on the authenticated path.
@@ -384,15 +406,43 @@ export default class DatabricksTelemetryExporter {
384406
char_set_encoding: metric.driverConfig.charSetEncoding,
385407
process_name: sanitizeProcessName(metric.driverConfig.processName) || undefined,
386408
};
409+
410+
// auth_type and host/http-path are workspace-correlated, so they ride
411+
// the same auth-only path as system_configuration.
412+
if (metric.driverConfig.authType) {
413+
log.entry.sql_driver_log.auth_type = metric.driverConfig.authType;
414+
}
415+
log.entry.sql_driver_log.driver_connection_params = {
416+
host_info: { host_url: this.host },
417+
http_path: metric.driverConfig.httpPath,
418+
enable_arrow: metric.driverConfig.arrowEnabled,
419+
enable_direct_results: metric.driverConfig.directResultsEnabled,
420+
socket_timeout: metric.driverConfig.socketTimeout,
421+
enable_metric_view_metadata: metric.driverConfig.enableMetricViewMetadata,
422+
cloud_fetch_enabled: metric.driverConfig.cloudFetchEnabled,
423+
lz4_enabled: metric.driverConfig.lz4Enabled,
424+
retry_max_attempts: metric.driverConfig.retryMaxAttempts,
425+
cloud_fetch_concurrent_downloads: metric.driverConfig.cloudFetchConcurrentDownloads,
426+
};
387427
}
388428
} else if (metric.metricType === 'statement') {
389429
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;
390430

391-
if (metric.resultFormat || metric.chunkCount) {
431+
if (metric.resultFormat || metric.chunkCount || metric.operationType || metric.compressed !== undefined) {
392432
log.entry.sql_driver_log.sql_operation = {
393433
execution_result: metric.resultFormat,
394434
};
395435

436+
if (metric.compressed !== undefined) {
437+
log.entry.sql_driver_log.sql_operation.is_compressed = metric.compressed;
438+
}
439+
440+
if (metric.operationType) {
441+
log.entry.sql_driver_log.sql_operation.operation_detail = {
442+
operation_type: metric.operationType,
443+
};
444+
}
445+
396446
if ((metric.chunkCount ?? 0) > 0) {
397447
log.entry.sql_driver_log.sql_operation.chunk_details = {
398448
total_chunks_present: metric.chunkCount,

lib/telemetry/telemetryTypeMappers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export function mapOperationTypeToTelemetryType(operationType?: TOperationType):
5151
/**
5252
* Map Thrift TSparkRowSetType to telemetry ExecutionResult.Format enum string.
5353
*/
54-
export function mapResultFormatToTelemetryType(resultFormat?: TSparkRowSetType): string | undefined {
54+
export function mapResultFormatToTelemetryType(resultFormat?: TSparkRowSetType): string {
5555
if (resultFormat === undefined) {
56-
return undefined;
56+
return 'FORMAT_UNSPECIFIED';
5757
}
5858

5959
switch (resultFormat) {

0 commit comments

Comments
 (0)