tally monkit: change location to monitor piecesize

When we observed the value for total piecesizes stored in the network,
we were doing it after converting them to byte-hours, rather than using
the actual piece sizes. This fixes that issue.

Change-Id: I1564d21b519f70eb59f298d97dbd777baf127723
This commit is contained in:
Isaac Hess 2021-01-25 13:07:24 -07:00 committed by Stefan Benten
parent 0b2568d712
commit c92bda7e75
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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(`