Skip to content

Commit feeb49c

Browse files
committed
Fix rows.NewRows calls to include telemetry parameters
After rebase, rows.NewRows signature now requires telemetry context and callback for tracking chunk downloads. Updated both call sites in QueryContext and staging operations to provide these parameters.
1 parent 6111f83 commit feeb49c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

connection.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,15 @@ func (c *conn) QueryContext(ctx context.Context, query string, args []driver.Nam
216216
return nil, dbsqlerrint.NewExecutionError(ctx, dbsqlerr.ErrQueryExecution, err, opStatusResp)
217217
}
218218

219-
rows, err := rows.NewRows(ctx, exStmtResp.OperationHandle, c.client, c.cfg, exStmtResp.DirectResults)
219+
// Telemetry callback for tracking row fetching metrics
220+
telemetryUpdate := func(chunkCount int, bytesDownloaded int64) {
221+
if c.telemetry != nil {
222+
c.telemetry.AddTag(ctx, "chunk_count", chunkCount)
223+
c.telemetry.AddTag(ctx, "bytes_downloaded", bytesDownloaded)
224+
}
225+
}
226+
227+
rows, err := rows.NewRows(ctx, exStmtResp.OperationHandle, c.client, c.cfg, exStmtResp.DirectResults, ctx, telemetryUpdate)
220228
return rows, err
221229

222230
}
@@ -646,7 +654,14 @@ func (c *conn) execStagingOperation(
646654
}
647655

648656
if len(driverctx.StagingPathsFromContext(ctx)) != 0 {
649-
row, err = rows.NewRows(ctx, exStmtResp.OperationHandle, c.client, c.cfg, exStmtResp.DirectResults)
657+
// Telemetry callback for staging operation row fetching
658+
telemetryUpdate := func(chunkCount int, bytesDownloaded int64) {
659+
if c.telemetry != nil {
660+
c.telemetry.AddTag(ctx, "chunk_count", chunkCount)
661+
c.telemetry.AddTag(ctx, "bytes_downloaded", bytesDownloaded)
662+
}
663+
}
664+
row, err = rows.NewRows(ctx, exStmtResp.OperationHandle, c.client, c.cfg, exStmtResp.DirectResults, ctx, telemetryUpdate)
650665
if err != nil {
651666
return dbsqlerrint.NewDriverError(ctx, "error reading row.", err)
652667
}

0 commit comments

Comments
 (0)