Commit Graph

28 Commits

Author SHA1 Message Date
Clement Sam
7461ffe148 {storagenode,web/multinode}: fix storage usage db/cache retrieval queries
The query changes we did while fixing the usage graph led to wrong
payout calculations directly linked to disk space.

This change:

- avoids converting from Bh to B directly in the query
- returns the at_rest_total in the original bytes*hour value
- returns at_rest_total_bytes as the calculated disk spaced used in bytes
- uses the at_rest_total_bytes only for the disk space graph
- return summary_bytes as the average disk space used within the specified date
- updates the disk space graph header to "average disk space used this month"

The total disk used in the month is also displayed in B not B*day

Resolves https://github.com/storj/storj/issues/5355

Change-Id: I2cfefb0fe711f9c59de2adb547c4ab50b05c7cbb
2022-12-09 11:07:33 +00:00
Clement Sam
3e0a4230a5 storagenode/payout: fix disk space value at payout
Payout is still calculating using the tb*h. 0So it’s getting the total disk space used this month and dividing by (24*30) instead of just 30.

More context here: https://forum.storj.io/t/current-month-earnings-in-node-v1-67-1/20319/5

Follow up PR for https://github.com/storj/storj/issues/5146

Change-Id: Ie2d48497f2a9bdbc995c99ee27e70b46580ff638
2022-11-18 01:04:20 +00:00
Egon Elbre
05e165283f storagenode/console/consoleapi: use fixed time.Now()
It seems the tests relied on time.Now(), which might cause some
discrepancies in calculations. Use a fixed time.Now() rather than
recalculating.

As a sidefix, remove "Test" prefix from t.Run. These are unnecessary.

Change-Id: I1de903fcf0fcf46fc8e3acf2463e17239b8e3cc6
2022-07-01 12:36:01 +03:00
TungHoang
f9b630b0f4
Fix monthly earning estimation (#4282) 2021-11-17 18:26:21 -05:00
igor gaidaienko
92deef4f34 Revert "storagenode/payouts: historical payouts use satellitesDB instead of trustPool"
This reverts commit 4a98dd40e2.
2021-08-02 13:55:21 +03:00
Qweder93
4a98dd40e2 storagenode/payouts: historical payouts use satellitesDB instead of trustPool
Change-Id: I39f4215f4ebf91bd1b38fbcb5c58e6ba53ceff1b
2021-07-15 16:19:18 +03:00
Qweder93
4d0fe39235 storagenode/satellites: address added, caching satellite's addresses from trust
Change-Id: Ica3eea5b8d81b176c6a4385fea803730b08ece16
2021-07-08 15:38:23 +00:00
Qweder93
d8c11a79b9 multinode/payouts: paystub extended with disposed
added Disposed to paystub struct to count NetTotal value.

Change-Id: Iaae1f98a69b82166ba5594e8589c7d2a540bd07f
2021-06-01 16:28:20 +00:00
Yaroslav Vorobiov
23f9beb635 multinode/console: held amount summary
Change-Id: Ia800748343e363d930ce0a0b9ab286b5abdc96af
2021-05-28 20:05:16 +03:00
Qweder93
099a31c69f multinode/payouts: paystubs for single period added
paystubs for single/all satellites for specific period added.

Change-Id: Ibb822aa11380bc70f4db8c81fa0b9b6f7a739078
2021-05-25 18:59:05 +03:00
Qweder93
1bc4f8fccd multinode/payouts: paystubs for all time added
paystubs for single/all satellites for all time added.

Change-Id: Ia665c69994f769cb0071363a617eaf87ef1a05f2
2021-05-25 18:19:23 +03:00
Qweder93
79172777bd mnd/payouts: estimations replaced with expectations
Added expectations endpoint (estimations and distributed), added
coalesce to db query, so in case of empty payouts db 0 will be returned instead of error.

Change-Id: I535f14ef097876448d8949bc302895b25da2b6e7
2021-05-24 18:11:30 +00:00
Qweder93
f0dd7f3739 mnd/payouts: undistributed payouts added
Change-Id: Id61ac58fceca13b9a9e12a7e03c3d9624cce3fea
2021-05-24 18:20:08 +03:00
Qweder93
19561698ba multinode/payouts: all satellites summaries added.
payout summaries for specific/all periods added.

Change-Id: I92087edec548c0418a0f543d643e59f5c7df9621
2021-05-12 18:43:47 +03:00
Qweder93
a11698f370 multinode/payouts: estimated payouts added
estimated payouts for specific/all satellites added.

Change-Id: I2530c9f1775593588e2a8f6c087ce6b4f9e354c4
2021-05-11 11:33:32 +00:00
Egon Elbre
961e841bd7 all: fix error naming
errs.Class should not contain "error" in the name, since that causes a
lot of stutter in the error logs. As an example a log line could end up
looking like:

    ERROR node stats service error: satellitedbs error: node stats database error: no rows

Whereas something like:

    ERROR nodestats service: satellitedbs: nodestatsdb: no rows

Would contain all the necessary information without the stutter.

Change-Id: I7b7cb7e592ebab4bcfadc1eef11122584d2b20e0
2021-04-29 15:38:21 +03:00
Qweder93
c4293f5e52 storagenode/payouts: DQ satellites removed from estimated payouts
Change-Id: Ib3fb287bbdece5386a2a6f257b54411ad5b742be
2021-04-01 11:17:27 +00:00
Qweder93
866a3e3ad3 storagenode/console: estimated payout tests fix
Added check if days paste <1 and node joined in current month -> days paste = 1

Change-Id: Ice1ccd6c869f629a87da585850b9b4f3729ec65c
2021-03-24 18:05:37 +02:00
Qweder93
487ad84b23 storagenode:consoleAPI flacky tests for estimatedPayout fixed
joinedAt date now is 2 months before time.Now which should fix calculations on early dates.

Change-Id: I6250ec2463c2dd609e811b74d908a02a3e64f19a
2021-03-13 20:33:25 +02:00
Qweder93
f2be856864 storagenode/payouts: estimated payouts calculations upgraded
Added recalculations of estimated income in current month in case
node joined in current month

Change-Id: Iac925fd8bcf2be8f1089e5f001a01448ba7650be
2021-02-25 14:11:44 +00:00
NickolaiYurchenko
badd6d12d4 web/satellite: distributed amount added to tables, content changed
Change-Id: Ib0eb3fa3f4f9d451f4b4048a6409d19968a41956
2021-02-24 16:01:40 +00:00
Qweder93
dcf7b884ca storagenode/payouts: estimated payouts calculations fixed
Change-Id: I9d5d180aea1606350e0d9214fbf352bf9f76c184
2021-02-17 12:58:41 +00:00
Qweder93
b92a86e524 storagenode/payouts: earned amount at satellite and list of paying satellites IDs added to DB
Change-Id: I66e34d6d80e37481d6eaae4c7bd017a7e096a751
2021-02-04 10:19:08 +00:00
Qweder93
e383722812 storagenode/payouts: Distributed added to paystubs
Change-Id: I02ba1f681be84765a0a5dae7af17d2a6674e7cca
2021-02-02 13:51:43 +00:00
Egon Elbre
5d895fb404 storagenode/{payouts,console}: use same time for all calculations
When using calling time.Now() multiple times, they can cross
month boundary causing errors in calculations.

Change-Id: I66b5be7598f3bf475b4b5fe0dcce82eee55b3134
2021-02-01 13:59:50 +02:00
Egon Elbre
8a3db08f68 storagenode/payouts/estimatedpayouts: fix calculations
Change-Id: Iaa01ebd06a32c19d3ddc46b52524020e51212a7b
2021-02-01 13:32:56 +02:00
Qweder93
c139cbd76b storagenode/payouts: fix CurrentMonthExpectations timezone handling. Estimations based on node's join date.
On servers with non-UTC it would have calculated a different month boundary.
If node joined in current month calculations will be related on amount of days node've been working.

Change-Id: Ie572b197f50c6cdff5a044a53dfb5b9138f82f24
2021-01-25 19:03:30 +02:00
Qweder93
6ba8f6c8a9 storanode, satellite: payout renamed to payouts, expected estimation payouts added, console api for audits reworked
Change-Id: I4aa5e99bffaa87d0a800a429a4c83aa498ad4b7b
2021-01-18 10:56:03 +00:00