-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stats): adding stats HTTP server to provide statistics about loc…
…al p2pool (#25) Description --- Adding statistics and expose them over an HTTP server. Stats: - [x] Pool hashrate - [ ] Network hashrate (can be checked when tribes are implemented) - [x] Number of miners - [x] Last block won - [x] Connected (to the network) - [x] Connected time - [x] estimated earning in XTM in 1min, 1h, 24h, 7d, 30d for all miners - [x] estimated earning of pool in XTM in 1min, 1h, 24h, 7d, 30d - [ ] Submitted/Accepted/Rejected blocks Motivation and Context --- Tari Universe wants to use metrics to show/use states about the current pool. How Has This Been Tested? --- - Running a miner and a p2pool node normally. - Query http://127.0.0.1:19000/stats - Checking output Example output: ```json { "connected": true, "connected_since": 1722519838, "num_of_miners": 2, "last_block_won": { "hash": "9c4fc0a3d996c6544e25b41ec0cf3a8bf771ac20fd0b7ae367e56ea597265d4f", "height": 5025, "timestamp": 1722518118, "miner_wallet_address": "f27mEvFXUZJCNFQM1MbkRwBnNJHwsK6JBxzrwVyYNm6bgGHpL1xDj7Gjevwj9caFrp23iLGUcysK6decdDL87sQCtL2" }, "share_chain_height": 5196, "pool_hash_rate": [2536963], "pool_total_earnings": 27782378316, "pool_total_estimated_earnings": { "1min": 409165920, "1h": 24549955200, "1d": 589198924800, "1w": 4124392473600, "30d": 17675967744000 }, "total_earnings": { "f27mEvFXUZJCNFQM1MbkRwBnNJHwsK6JBxzrwVyYNm6bgGHpL1xDj7Gjevwj9caFrp23iLGUcysK6decdDL87sQCtL2": 5556473688, "f2CrtWaTZE3xWSxCkR1mR9Bszx321Ar2S1fPcBLNSNWiLBVwqkeankFjeTmdxYLuyeHg8oM4vSgsV1tjL4GSKEuy9pk": 8334710532 }, "estimated_earnings": { "f2CrtWaTZE3xWSxCkR1mR9Bszx321Ar2S1fPcBLNSNWiLBVwqkeankFjeTmdxYLuyeHg8oM4vSgsV1tjL4GSKEuy9pk": { "1min": 245499540, "1h": 14729972400, "1d": 353519337600, "1w": 2474635363200, "30d": 10605580128000 }, "f27mEvFXUZJCNFQM1MbkRwBnNJHwsK6JBxzrwVyYNm6bgGHpL1xDj7Gjevwj9caFrp23iLGUcysK6decdDL87sQCtL2": { "1min": 163666380, "1h": 9819982800, "1d": 235679587200, "1w": 1649757110400, "30d": 7070387616000 } } } ``` What process can a PR reviewer use to test or verify this change? --- Do the steps at test. Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
- Loading branch information
Showing
20 changed files
with
826 additions
and
189 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright 2024 The Tari Project | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
pub mod stats; |
Oops, something went wrong.