Skip to content

Commit

Permalink
quaistats: Reworked the stats package in the client to send new stats
Browse files Browse the repository at this point in the history
  • Loading branch information
robschleusner committed Nov 8, 2023
1 parent 6cee1f5 commit 7666115
Show file tree
Hide file tree
Showing 7 changed files with 889 additions and 815 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ endif
ifeq ($(QUAI_STATS),true)
BASE_CMD += --quaistats ${STATS_NAME}:${STATS_PASS}@${STATS_HOST}
endif
ifeq ($(SEND_FULL_STATS),true)
BASE_CMD += --sendfullstats
endif

ifeq ($(SHOW_COLORS),true)
BASE_CMD += --showcolors
Expand Down
3 changes: 2 additions & 1 deletion cmd/go-quai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, quaiConfig) {
func makeFullNode(ctx *cli.Context) (*node.Node, quaiapi.Backend) {
stack, cfg := makeConfigNode(ctx)
backend, _ := utils.RegisterEthService(stack, &cfg.Eth)
sendfullstats := ctx.Bool(utils.SendFullStatsFlag.Name)

// Add the Quai Stats daemon if requested.
if cfg.Ethstats.URL != "" {
utils.RegisterQuaiStatsService(stack, backend, cfg.Ethstats.URL)
utils.RegisterQuaiStatsService(stack, backend, cfg.Ethstats.URL, sendfullstats)
}
return stack, backend
}
Expand Down
1 change: 1 addition & 0 deletions cmd/go-quai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ var (
utils.OrchardFlag,
utils.PasswordFileFlag,
utils.QuaiStatsURLFlag,
utils.SendFullStatsFlag,
utils.RegionFlag,
utils.ShowColorsFlag,
utils.SlicesRunningFlag,
Expand Down
1 change: 1 addition & 0 deletions cmd/go-quai/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.GCModeFlag,
utils.TxLookupLimitFlag,
utils.QuaiStatsURLFlag,
utils.SendFullStatsFlag,
utils.IdentityFlag,
utils.LightKDFFlag,
utils.WhitelistFlag,
Expand Down
8 changes: 6 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ var (
Name: "quaistats",
Usage: "Reporting URL of a quaistats service (nodename:secret@host:port)",
}
SendFullStatsFlag = cli.BoolFlag{
Name: "sendfullstats",
Usage: "Send full stats boolean flag for quaistats",
}
FakePoWFlag = cli.BoolFlag{
Name: "fakepow",
Usage: "Disables proof-of-work verification",
Expand Down Expand Up @@ -1633,8 +1637,8 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (quaiapi.Backen

// RegisterQuaiStatsService configures the Quai Stats daemon and adds it to
// the given node.
func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string) {
if err := quaistats.New(stack, backend, backend.Engine(), url); err != nil {
func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string, sendfullstats bool) {
if err := quaistats.New(stack, backend, backend.Engine(), url, sendfullstats); err != nil {
Fatalf("Failed to register the Quai Stats service: %v", err)
}
}
Expand Down
3 changes: 1 addition & 2 deletions core/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,8 @@ func (sl *Slice) Append(header *types.Header, domPendingHeader *types.Header, do
return nil, false, false, err
}

time9 = common.PrettyDuration(time.Since(start))

}
time9 = common.PrettyDuration(time.Since(start))
sl.updatePhCache(pendingHeaderWithTermini, true, nil, subReorg, common.NodeLocation)

var updateDom bool
Expand Down
Loading

0 comments on commit 7666115

Please sign in to comment.