chore(health): log out duration of tries in milliseconds
This commit is contained in:
@@ -237,8 +237,8 @@ func withRetries(ctx context.Context, tryTimeouts []time.Duration,
|
|||||||
) error {
|
) error {
|
||||||
maxTries := len(tryTimeouts)
|
maxTries := len(tryTimeouts)
|
||||||
type errData struct {
|
type errData struct {
|
||||||
err error
|
err error
|
||||||
duration time.Duration
|
durationMS int64
|
||||||
}
|
}
|
||||||
errs := make([]errData, maxTries)
|
errs := make([]errData, maxTries)
|
||||||
for i, timeout := range tryTimeouts {
|
for i, timeout := range tryTimeouts {
|
||||||
@@ -254,12 +254,12 @@ func withRetries(ctx context.Context, tryTimeouts []time.Duration,
|
|||||||
}
|
}
|
||||||
logger.Debugf("%s attempt %d/%d failed: %s", checkName, i+1, maxTries, err)
|
logger.Debugf("%s attempt %d/%d failed: %s", checkName, i+1, maxTries, err)
|
||||||
errs[i].err = err
|
errs[i].err = err
|
||||||
errs[i].duration = time.Since(start)
|
errs[i].durationMS = time.Since(start).Round(time.Millisecond).Milliseconds()
|
||||||
}
|
}
|
||||||
|
|
||||||
errStrings := make([]string, len(errs))
|
errStrings := make([]string, len(errs))
|
||||||
for i, err := range errs {
|
for i, err := range errs {
|
||||||
errStrings[i] = fmt.Sprintf("attempt %d (%s): %s", i+1, err.duration, err.err)
|
errStrings[i] = fmt.Sprintf("attempt %d (%dms): %s", i+1, err.durationMS, err.err)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("%w: %s", ErrAllCheckTriesFailed, strings.Join(errStrings, ", "))
|
return fmt.Errorf("%w: %s", ErrAllCheckTriesFailed, strings.Join(errStrings, ", "))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user