Skip to content

Commit adb70bc

Browse files
samikshya-dbclaude
andcommitted
Add operation types to connection metrics
Connection metrics now include operation type in sql_operation: - CREATE_SESSION for connection open events - DELETE_SESSION for connection close events This matches the proto Operation.Type enum which includes session-level operations in addition to statement-level operations. Before: sql_operation: null After: sql_operation: { statement_type: "CREATE_SESSION" // or "DELETE_SESSION" } Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 316d1e9 commit adb70bc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/telemetry/DatabricksTelemetryExporter.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,17 @@ export default class DatabricksTelemetryExporter {
319319

320320
// Add metric-specific fields based on proto definition
321321
if (metric.metricType === 'connection') {
322-
// Include connection open latency
322+
// Include connection latency
323323
if (metric.latencyMs !== undefined) {
324324
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;
325325
}
326+
327+
// Include operation type (CREATE_SESSION or DELETE_SESSION)
328+
if (metric.operationType) {
329+
log.entry.sql_driver_log.sql_operation = {
330+
statement_type: metric.operationType,
331+
};
332+
}
326333
} else if (metric.metricType === 'statement') {
327334
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;
328335

lib/telemetry/MetricsAggregator.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default class MetricsAggregator {
142142
sessionId: event.sessionId,
143143
workspaceId: event.workspaceId,
144144
driverConfig: event.driverConfig,
145+
operationType: 'CREATE_SESSION',
145146
latencyMs: event.latencyMs,
146147
};
147148

@@ -157,6 +158,7 @@ export default class MetricsAggregator {
157158
timestamp: event.timestamp,
158159
sessionId: event.sessionId,
159160
driverConfig: this.driverConfig,
161+
operationType: 'DELETE_SESSION',
160162
latencyMs: event.latencyMs,
161163
};
162164

0 commit comments

Comments
 (0)