Merge pull request #3775 from weaveworks/revert-6b72246f

Revert #3773 - change to use report timestamp
This commit is contained in:
Bryan Boreham
2020-03-28 14:52:16 +00:00
committed by GitHub
4 changed files with 2 additions and 7 deletions

View File

@@ -348,7 +348,6 @@ func replay(a Adder, timestamps []time.Time, reports []report.Report) {
due := time.Now()
for {
for i, r := range reports {
r.TS = due
a.Add(nil, r, nil)
due = due.Add(delays[i])
delay := due.Sub(time.Now())

View File

@@ -538,7 +538,7 @@ func (c *awsCollector) Add(ctx context.Context, rep report.Report, buf []byte) e
}
// first, put the report on s3
rowKey, colKey := calculateDynamoKeys(userid, rep.TS)
rowKey, colKey := calculateDynamoKeys(userid, time.Now())
reportKey, err := calculateReportKey(rowKey, colKey)
if err != nil {
return err

View File

@@ -59,7 +59,7 @@ func (e *BillingEmitter) Add(ctx context.Context, rep report.Report, buf []byte)
// proceeding.
return err
}
rowKey, colKey := calculateDynamoKeys(userID, rep.TS)
rowKey, colKey := calculateDynamoKeys(userID, now)
interval := e.reportInterval(rep)
// Cache the last-known value of interval for this user, and use

View File

@@ -148,10 +148,6 @@ func RegisterReportPostHandler(a Adder, router *mux.Router) {
buf, _ = rpt.WriteBinary()
}
// If it didn't come in with a timestamp, give it one now
if rpt.TS.IsZero() {
rpt.TS = time.Now().UTC()
}
if err := a.Add(ctx, *rpt, buf.Bytes()); err != nil {
log.Errorf("Error Adding report: %v", err)
respondWith(w, http.StatusInternalServerError, err)