Skip to content

Commit 15c10ce

Browse files
committed
interal/upload: improve error messages
If a count file contains no counters, log that fact. If no count file contains counters, say that in the error message. Change-Id: Ic36564d1dfeab26451435529cbe65343a0ed7bfa Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/585195 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
1 parent f87de6f commit 15c10ce

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/upload/reports.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ func (u *Uploader) createReport(start time.Time, expiryDate string, countFiles [
147147
}
148148
var succeeded bool
149149
for _, f := range countFiles {
150+
fok := false
150151
x, err := u.parseCountFile(f)
151152
if err != nil {
152153
u.logger.Printf("Unparseable count file %s: %v", filepath.Base(f), err)
@@ -162,12 +163,14 @@ func (u *Uploader) createReport(start time.Time, expiryDate string, countFiles [
162163
prog.Counters[k] += int64(v)
163164
}
164165
succeeded = true
166+
fok = true
167+
}
168+
if !fok {
169+
u.logger.Printf("no counters found in %s", f)
165170
}
166171
}
167172
if !succeeded {
168-
// TODO(rfindley): this isn't right: a count file is not unparseable just
169-
// because it has no counters
170-
return "", fmt.Errorf("all %d count files for %s were unparseable", len(countFiles), expiryDate)
173+
return "", fmt.Errorf("none of the %d count files for %s contained counters", len(countFiles), expiryDate)
171174
}
172175
// 1. generate the local report
173176
localContents, err := json.MarshalIndent(report, "", " ")

0 commit comments

Comments
 (0)