-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Backporting Statoshi and bitcoin#16728 #2515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@UdjinM6 Umm, "Dashtoshi" maybe? 😉 |
|
I think the point is to have „stat“ in the name :-)
Statdashi? Statduff? :-D
|
41c259f to
a6106a6
Compare
|
This is on my wishlist since some time already 👍 However, there are some issues with this implementation:
|
|
Oh and regarding the name, I'm for keeping statoshi. If it turns out to be used by more projects, fancy UIs and specialized daemons will pop up and then it's good to let people know that we're compatible. |
|
@UdjinM6 Will it be difficult to add some Dash-specific stats to this? For example, it would be interesting to see things like the average "lock time" for InstantSend txs (time between seeing the |
|
@thephez shouldn't be very hard I guess but maybe in another PR. And first we have to make it compilable if we ever want to merge this... (windows build fails atm) |
81130cc to
e935c10
Compare
244dcd5 to
77f8bed
Compare
900f27d to
9495265
Compare
440b4ea to
2fcf82f
Compare
c5f6eb6 to
a7191ef
Compare
src/statsd_client.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be proper to add an MIT header?
This backports some of https://github.com/jlopp/statoshi. Missing stuff: README.md and client name changes, segwit and fee estimation stats. Fix RejectCodeToString Fix copy-paste mistake s/InvalidBlockFound/InvalidChainFound/
8a3b2eb move-only: move coins statistics utils out of RPC (James O'Beirne) Pull request description: This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11): Parent PR: bitcoin#15606 Issue: bitcoin#15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal --- In the short-term, this move-only commit will help with fuzzing (bitcoin#15606 (comment)). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots. Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it. ACKs for top commit: MarcoFalke: ACK 8a3b2eb, checked --color-moved=dimmed-zebra Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74
- Reuse some functionality from netbase - Switch from GetRand to FastRandomContext - Drop `using namespace std` and add `// namespace statsd`
…<smth> (enabled/host/port/ns/period)
…-locale-dependence.sh
And bail out early if stats are disabled
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
PastaPastaPasta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I'm leaning towards mentioning bitcoin 16728 in the title. |
xdustinface
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
* Backport Statoshi This backports some of https://github.com/jlopp/statoshi. Missing stuff: README.md and client name changes, segwit and fee estimation stats. Fix RejectCodeToString Fix copy-paste mistake s/InvalidBlockFound/InvalidChainFound/ * Merge bitcoin#16728: move-only: move coins statistics utils out of RPC 8a3b2eb move-only: move coins statistics utils out of RPC (James O'Beirne) Pull request description: This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11): Parent PR: bitcoin#15606 Issue: bitcoin#15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal --- In the short-term, this move-only commit will help with fuzzing (bitcoin#15606 (comment)). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots. Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it. ACKs for top commit: MarcoFalke: ACK 8a3b2eb, checked --color-moved=dimmed-zebra Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74 * Fix 16728 * Modernize StatsdClient - Reuse some functionality from netbase - Switch from GetRand to FastRandomContext - Drop `using namespace std` and add `// namespace statsd` * Introduce PeriodicStats and make StatsdClient configurable via -stats<smth> (enabled/host/port/ns/period) * Move/rename tip stats from CheckBlock to ConnectBlock * Add new false positives to lint-format-strings.py * Add snprintf in statsd_client to the list of known violations in lint-locale-dependence.sh * Fix incorrect include guard * Use bracket syntax includes * Replace magic numbers with defaults * Move connection stats calculation into its own function And bail out early if stats are disabled * assert in PeriodicStats Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: MarcoFalke <falke.marco@gmail.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
…global `unique_ptr` cc998ab fmt: apply `clang-format-diff.py` suggestions (Kittywhiskers Van Gogh) 0401c58 stats: `const`-ify variables and arguments (Kittywhiskers Van Gogh) 9f96723 stats: stop using error codes, switch over to `bool` (Kittywhiskers Van Gogh) 1a81979 stats: initialize socket after we have a valid socket address (Kittywhiskers Van Gogh) dbbfc8d stats: use `Socks` wrapper, use `CService` to generate our `sockaddr` (Kittywhiskers Van Gogh) 2def905 stats: move init logic into constructor (Kittywhiskers Van Gogh) 4bc727c stats: clean up randomization code, move `FastRandomContext` inward (Kittywhiskers Van Gogh) 840241e stats: cleanup error logging, improve code sanity (Kittywhiskers Van Gogh) 85890dd docs: add copyright notice to source file, update notice in header (Kittywhiskers Van Gogh) a9d1b14 stats: move `_StatsdClientData` variables into `StatsdClient` (Kittywhiskers Van Gogh) 30c30c1 stats: fetch all arguments needed when constructing `g_stats_client` (Kittywhiskers Van Gogh) 5133d88 stats: s/statsClient/g_stats_client/g (Kittywhiskers Van Gogh) f81951d stats: make `statsClient` a `std::unique_ptr`, denote as global variable (Kittywhiskers Van Gogh) Pull request description: ## Additional Information Support for transmitting stats to a Statsd server has been courtesy of Statoshi ([repo](https://github.com/jlopp/statoshi)), implemented Dec, 2020 by [dash#2515](#2515) but since then, it hasn't gotten much attention aside from benefiting from codebase-wide changes and the occasional compiler appeasement. This pull request aims to give our statistics code some TLC. Changes include: * Limiting initialization to solely during construction and moving the responsibility of fetching arguments outside of `statsd::StatsdClient`. * Using the RAII `Socks` wrapper as early as possible (we still need to construct a raw socket ourselves but this is done in the initializer and control is moved to the wrapper and everywhere else, the wrapper is used) * Utilizing existing networking code to generate the socket address * This lets us trivially allow IPv6 connections as the responsibility to construct it safely is moved to `CService`. * Using `std::string` and our string manipulation capabilities (replacing `snprintf` with `strprintf`), replacing platform-specific types (replacing `short` with `uint16_t`). ## Breaking Changes None observed. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone ACKs for top commit: PastaPastaPasta: utACK [cc998ab](cc998ab) UdjinM6: utACK cc998ab Tree-SHA512: 433c92160d6ac7ebb8582ada3cbb65ead7913618266b773619a528c90dfe0e286aafa46dc3b0bca62f246938e5948a732080e2cddba942d3627f007ca6efcc1f
This backports some of https://github.com/jlopp/statoshi.
Missing stuff: README.md and client name changes, segwit and fee estimation stats.
New stuff: fixed cross-platform compilation, added new
configure andcmd-line options.Not tested yet, feel free to play with it and report if it works or not :)NOTE: this version is (re)based ondevelopand is NOT compatible with mainnet atm. To run it on mainnet pealse use this fork https://github.com/UdjinM6/dash/tree/dashtoshi_v13 which has the same commits backported tomaster.Should be fully compatible with mainnet now that spork15 is activated.