diff --git a/monkit.lock b/monkit.lock index 6bfad7daf..2da0b2118 100644 --- a/monkit.lock +++ b/monkit.lock @@ -6,6 +6,7 @@ storj.io/storj/satellite/accounting/tally."bucket_objects" IntVal storj.io/storj/satellite/accounting/tally."bucket_remote_bytes" IntVal storj.io/storj/satellite/accounting/tally."bucket_remote_segments" IntVal storj.io/storj/satellite/accounting/tally."bucket_segments" IntVal +storj.io/storj/satellite/accounting/tally."nodetallies.totalsum" IntVal storj.io/storj/satellite/accounting/tally."total_bytes" IntVal storj.io/storj/satellite/accounting/tally."total_inline_bytes" IntVal storj.io/storj/satellite/accounting/tally."total_inline_segments" IntVal @@ -112,7 +113,6 @@ storj.io/storj/satellite/satellitedb."audit_online_score" FloatVal storj.io/storj/satellite/satellitedb."audit_reputation_alpha" FloatVal storj.io/storj/satellite/satellitedb."audit_reputation_beta" FloatVal storj.io/storj/satellite/satellitedb."bad_audit_dqs" Meter -storj.io/storj/satellite/satellitedb."nodetallies.totalsum" IntVal storj.io/storj/satellite/satellitedb."offline_dqs" Meter storj.io/storj/satellite/satellitedb."unknown_audit_reputation_alpha" FloatVal storj.io/storj/satellite/satellitedb."unknown_audit_reputation_beta" FloatVal diff --git a/satellite/accounting/tally/tally.go b/satellite/accounting/tally/tally.go index d7ad57bc6..6f92ab3e5 100644 --- a/satellite/accounting/tally/tally.go +++ b/satellite/accounting/tally/tally.go @@ -184,9 +184,12 @@ func (service *Service) Tally(ctx context.Context) (err error) { // calculate byte hours, not just bytes hours := time.Since(lastTime).Hours() - for id := range observer.Node { - observer.Node[id] *= hours + var totalSum float64 + for id, pieceSize := range observer.Node { + totalSum += pieceSize + observer.Node[id] = pieceSize * hours } + mon.IntVal("nodetallies.totalsum").Observe(int64(totalSum)) //mon:locked // save the new results var errAtRest, errBucketInfo error diff --git a/satellite/satellitedb/storagenodeaccounting.go b/satellite/satellitedb/storagenodeaccounting.go index 0fbdc4e4d..b201bc0a1 100644 --- a/satellite/satellitedb/storagenodeaccounting.go +++ b/satellite/satellitedb/storagenodeaccounting.go @@ -32,13 +32,10 @@ func (db *StoragenodeAccounting) SaveTallies(ctx context.Context, latestTally ti } var nodeIDs []storj.NodeID var totals []float64 - var totalSum float64 for id, total := range nodeData { nodeIDs = append(nodeIDs, id) totals = append(totals, total) - totalSum += total } - mon.IntVal("nodetallies.totalsum").Observe(int64(totalSum)) //mon:locked err = db.db.WithTx(ctx, func(ctx context.Context, tx *dbx.Tx) error { _, err = tx.Tx.ExecContext(ctx, db.db.Rebind(`