Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

summary: add real time cost to log collector #480

Merged
merged 4 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/restore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ func (rc *Client) GoValidateChecksum(
}
elapsed := time.Since(start)
summary.CollectDuration("restore checksum", elapsed)
summary.CollectSuccessUnit("table checksum", 1, elapsed)
outCh <- struct{}{}
close(outCh)
}()
Expand Down
4 changes: 2 additions & 2 deletions pkg/restore/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ func (importer *FileImporter) Import(
zap.Error(errIngest))
return errIngest
}
summary.CollectSuccessUnit(summary.TotalKV, 1, file.TotalKvs)
summary.CollectSuccessUnit(summary.TotalBytes, 1, file.TotalBytes)
}
summary.CollectSuccessUnit(summary.TotalKV, 1, file.TotalKvs)
summary.CollectSuccessUnit(summary.TotalBytes, 1, file.TotalBytes)
return nil
}, newImportSSTBackoffer())
return err
Expand Down
5 changes: 4 additions & 1 deletion pkg/summary/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type logCollector struct {
ints map[string]int
uints map[string]uint64
successStatus bool
startTime time.Time

log logFunc
}
Expand All @@ -92,6 +93,7 @@ func newLogCollector(log logFunc) LogCollector {
ints: make(map[string]int),
uints: make(map[string]uint64),
log: log,
startTime: time.Now(),
}
}

Expand Down Expand Up @@ -189,7 +191,8 @@ func (tc *logCollector) Summary(name string) {
for _, cost := range tc.successCosts {
totalCost += cost
}
msg += fmt.Sprintf(", total take(s): %.2f", totalCost.Seconds())
msg += fmt.Sprintf(", total take(%s time): %s", name, totalCost)
msg += fmt.Sprintf(", total take(real time): %s", time.Since(tc.startTime))
for name, data := range tc.successData {
if name == TotalBytes {
fData := float64(data) / 1024 / 1024
Expand Down