feat: enhance logging and performance metrics for migration processes
This commit is contained in:
@@ -7,8 +7,12 @@ import (
|
||||
)
|
||||
|
||||
func transformRowsMssql(columns []ColumnType, in <-chan []UnknownRowValues, out chan<- []UnknownRowValues) {
|
||||
chunkCount := 0
|
||||
totalRowsTransformed := 0
|
||||
|
||||
for rows := range in {
|
||||
log.Debugf("Chunk received, transforming...")
|
||||
chunkStartTime := time.Now()
|
||||
log.Debugf("Chunk #%d received, transforming %d rows...", chunkCount+1, len(rows))
|
||||
|
||||
for _, rowValues := range rows {
|
||||
for i, col := range columns {
|
||||
@@ -29,6 +33,13 @@ func transformRowsMssql(columns []ColumnType, in <-chan []UnknownRowValues, out
|
||||
}
|
||||
}
|
||||
|
||||
chunkCount++
|
||||
totalRowsTransformed += len(rows)
|
||||
chunkDuration := time.Since(chunkStartTime)
|
||||
rowsPerSec := float64(len(rows)) / chunkDuration.Seconds()
|
||||
log.Infof("Transformed chunk #%d: %d rows in %v (%.0f rows/sec) - Total: %d rows",
|
||||
chunkCount, len(rows), chunkDuration, rowsPerSec, totalRowsTransformed)
|
||||
|
||||
out <- rows
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user