Skip to content

Commit

Permalink
log collection changes for survey endpoint name change
Browse files Browse the repository at this point in the history
  • Loading branch information
0pcom committed Feb 10, 2024
1 parent 9c1e917 commit 0083821
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
10 changes: 9 additions & 1 deletion cmd/skywire-cli/commands/log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ var logCmd = &cobra.Command{
Long: "Fetch health, survey, and transport logging from visors which are online in the uptime tracker\nhttp://ut.skywire.skycoin.com/uptimes?v=v2\nhttp://ut.skywire.skycoin.com/uptimes?v=v2&visors=<pk1>;<pk2>;<pk3>",
Run: func(cmd *cobra.Command, args []string) {
log := logging.MustGetLogger("log-collecting")
fver, err := version.NewVersion("v1.3.17")
if err != nil {
log.Fatal("can't parse version for filtering fetches")
}
if logOnly && surveyOnly {
log.Fatal("use of mutually exclusive flags --log and --survey")
}
Expand Down Expand Up @@ -202,7 +206,11 @@ var logCmd = &cobra.Command{
}
}
if !logOnly {
download(ctx, log, httpC, "node-info.json", "node-info.json", key, maxFileSize) //nolint
if visorVersion.LessThan(fver) {
download(ctx, log, httpC, "node-info.json", "node-info.json", key, maxFileSize) //nolint
} else {
download(ctx, log, httpC, "node-info", "node-info.json", key, maxFileSize) //nolint
}
}
if !surveyOnly {
for i := 0; i <= duration; i++ {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package clireward cmd/skywire-cli/commands/reward/root.go
package clireward
// Package clireward cmd/skywire-cli/commands/rewards/root.go

Check failure on line 1 in cmd/skywire-cli/commands/rewards/calc.go

View workflow job for this annotation

GitHub Actions / linux

package-comments: package comment should be of the form "Package clirewards ..." (revive)

Check failure on line 1 in cmd/skywire-cli/commands/rewards/calc.go

View workflow job for this annotation

GitHub Actions / darwin

package-comments: package comment should be of the form "Package clirewards ..." (revive)
package clirewards

import (
"fmt"
Expand Down Expand Up @@ -54,23 +54,21 @@ type rewardData struct {
}

func init() {
RootCmd.AddCommand(rewardCalcCmd)
rewardCalcCmd.Flags().SortFlags = false
rewardCalcCmd.Flags().StringVarP(&wdate, "date", "d", wdate, "date for which to calculate reward")
rewardCalcCmd.Flags().StringVarP(&pubkey, "pk", "k", pubkey, "check reward for pubkey")
rewardCalcCmd.Flags().StringVarP(&disallowArchitectures, "noarch", "n", "amd64", "disallowed architectures, comma separated")
rewardCalcCmd.Flags().IntVarP(&yearlyTotal, "year", "y", yearlyTotalRewards, "yearly total rewards")
rewardCalcCmd.Flags().StringVarP(&utfile, "utfile", "u", "ut.txt", "uptime tracker data file")
rewardCalcCmd.Flags().StringVarP(&surveyPath, "path", "p", "log_collecting", "path to the surveys")
rewardCalcCmd.Flags().BoolVarP(&h0, "h0", "0", false, "hide statistical data")
rewardCalcCmd.Flags().BoolVarP(&h1, "h1", "1", false, "hide survey csv data")
rewardCalcCmd.Flags().BoolVarP(&h2, "h2", "2", false, "hide reward csv data")
rewardCalcCmd.Flags().BoolVarP(&grr, "err", "e", false, "account for non rewarded keys")

RootCmd.Flags().SortFlags = false
RootCmd.Flags().StringVarP(&wdate, "date", "d", wdate, "date for which to calculate reward")
RootCmd.Flags().StringVarP(&pubkey, "pk", "k", pubkey, "check reward for pubkey")
RootCmd.Flags().StringVarP(&disallowArchitectures, "noarch", "n", "amd64", "disallowed architectures, comma separated")
RootCmd.Flags().IntVarP(&yearlyTotal, "year", "y", yearlyTotalRewards, "yearly total rewards")
RootCmd.Flags().StringVarP(&utfile, "utfile", "u", "ut.txt", "uptime tracker data file")
RootCmd.Flags().StringVarP(&surveyPath, "path", "p", "log_collecting", "path to the surveys")
RootCmd.Flags().BoolVarP(&h0, "h0", "0", false, "hide statistical data")
RootCmd.Flags().BoolVarP(&h1, "h1", "1", false, "hide survey csv data")
RootCmd.Flags().BoolVarP(&h2, "h2", "2", false, "hide reward csv data")
RootCmd.Flags().BoolVarP(&grr, "err", "e", false, "account for non rewarded keys")
}

var rewardCalcCmd = &cobra.Command{
Use: "calc",
var RootCmd = &cobra.Command{

Check failure on line 70 in cmd/skywire-cli/commands/rewards/calc.go

View workflow job for this annotation

GitHub Actions / linux

exported: exported var RootCmd should have comment or be unexported (revive)

Check failure on line 70 in cmd/skywire-cli/commands/rewards/calc.go

View workflow job for this annotation

GitHub Actions / darwin

exported: exported var RootCmd should have comment or be unexported (revive)
Use: "rewards",
Short: "calculate rewards from uptime data & collected surveys",
Long: `
Collect surveys: skywire-cli log
Expand Down
2 changes: 2 additions & 0 deletions cmd/skywire-cli/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
climdisc "github.com/skycoin/skywire/cmd/skywire-cli/commands/mdisc"
cliskysocksc "github.com/skycoin/skywire/cmd/skywire-cli/commands/proxy"
clireward "github.com/skycoin/skywire/cmd/skywire-cli/commands/reward"
clirewards "github.com/skycoin/skywire/cmd/skywire-cli/commands/rewards"
clirtfind "github.com/skycoin/skywire/cmd/skywire-cli/commands/rtfind"
cliservices "github.com/skycoin/skywire/cmd/skywire-cli/commands/services"
cliskyfwd "github.com/skycoin/skywire/cmd/skywire-cli/commands/skyfwd"
Expand Down Expand Up @@ -189,6 +190,7 @@ func init() {
cliskyfwd.RootCmd,
cliskyrev.RootCmd,
clireward.RootCmd,
clirewards.RootCmd,
clisurvey.RootCmd,
clirtfind.RootCmd,
climdisc.RootCmd,
Expand Down

0 comments on commit 0083821

Please sign in to comment.