Skip to content

Commit 25c8f51

Browse files
samikshya-dbclaude
andcommitted
Add driver_connection_params with available fields
- http_path: API endpoint path - socket_timeout: Connection timeout in milliseconds - enable_arrow: Whether Arrow format is enabled - enable_direct_results: Whether direct results are enabled - enable_metric_view_metadata: Whether metric view metadata is enabled - Only populate fields that are present Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8d6d819 commit 25c8f51

3 files changed

Lines changed: 41 additions & 2 deletions

File tree

lib/DBSQLClient.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient, I
8080
// Telemetry components (instance-based, NOT singletons)
8181
private host?: string;
8282

83+
private httpPath?: string;
84+
8385
private authType?: string;
8486

8587
private featureFlagCache?: FeatureFlagCache;
@@ -224,6 +226,10 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient, I
224226
socketTimeout: this.config.socketTimeout ?? 0,
225227
retryMaxAttempts: this.config.retryMaxAttempts ?? 0,
226228
cloudFetchConcurrentDownloads: this.config.cloudFetchConcurrentDownloads ?? 0,
229+
230+
// Connection parameters
231+
httpPath: this.httpPath,
232+
enableMetricViewMetadata: this.config.enableMetricViewMetadata,
227233
};
228234
}
229235

@@ -400,8 +406,9 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient, I
400406
}
401407
}
402408

403-
// Store host and auth type for telemetry (convert to telemetry auth enum)
409+
// Store connection params for telemetry
404410
this.host = options.host;
411+
this.httpPath = options.path;
405412
this.authType = this.mapAuthType(options);
406413

407414
// Store enableMetricViewMetadata configuration

lib/telemetry/DatabricksTelemetryExporter.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ interface DatabricksTelemetryLog {
5252
char_set_encoding?: string;
5353
process_name?: string;
5454
};
55+
driver_connection_params?: {
56+
http_path?: string;
57+
socket_timeout?: number;
58+
enable_arrow?: boolean;
59+
enable_direct_results?: boolean;
60+
enable_metric_view_metadata?: boolean;
61+
};
5562
auth_type?: string;
5663
operation_latency_ms?: number;
5764
sql_operation?: {
@@ -301,7 +308,25 @@ export default class DatabricksTelemetryExporter {
301308
if (metric.latencyMs !== undefined) {
302309
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;
303310
}
304-
// Include auth type at top level (proto field 5)
311+
// Include driver connection params (only if we have fields to include)
312+
if (
313+
metric.driverConfig.httpPath ||
314+
metric.driverConfig.socketTimeout ||
315+
metric.driverConfig.enableMetricViewMetadata !== undefined
316+
) {
317+
log.entry.sql_driver_log.driver_connection_params = {
318+
...(metric.driverConfig.httpPath && { http_path: metric.driverConfig.httpPath }),
319+
...(metric.driverConfig.socketTimeout && { socket_timeout: metric.driverConfig.socketTimeout }),
320+
...(metric.driverConfig.arrowEnabled !== undefined && { enable_arrow: metric.driverConfig.arrowEnabled }),
321+
...(metric.driverConfig.directResultsEnabled !== undefined && {
322+
enable_direct_results: metric.driverConfig.directResultsEnabled,
323+
}),
324+
...(metric.driverConfig.enableMetricViewMetadata !== undefined && {
325+
enable_metric_view_metadata: metric.driverConfig.enableMetricViewMetadata,
326+
}),
327+
};
328+
}
329+
// Include auth type at top level
305330
log.entry.sql_driver_log.auth_type = metric.driverConfig.authType;
306331
} else if (metric.metricType === 'statement') {
307332
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;

lib/telemetry/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ export interface DriverConfiguration {
241241

242242
/** Number of concurrent CloudFetch downloads */
243243
cloudFetchConcurrentDownloads: number;
244+
245+
// Connection parameters for telemetry
246+
/** HTTP path for API calls */
247+
httpPath?: string;
248+
249+
/** Whether metric view metadata is enabled */
250+
enableMetricViewMetadata?: boolean;
244251
}
245252

246253
/**

0 commit comments

Comments
 (0)