From 429eb764fd5aa0ccb6288eb59d579b5d63b07a30 Mon Sep 17 00:00:00 2001 From: Never M Date: Wed, 14 Apr 2021 11:04:40 +0300 Subject: [PATCH 01/19] Add log store interface --- pkg/visor/logstore/logstore.go | 12 ++++++++++++ pkg/visor/visor.go | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 pkg/visor/logstore/logstore.go diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go new file mode 100644 index 0000000000..ec807887c6 --- /dev/null +++ b/pkg/visor/logstore/logstore.go @@ -0,0 +1,12 @@ +package logstore + +import "github.com/sirupsen/logrus" + +type Store interface { + GetLogs() string + GetHook() logrus.Hook +} + +func MakeStore(maxEntries int) Store { + panic("not implemented") +} diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 3eb3df8e15..1479d154b5 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -26,6 +26,7 @@ import ( "github.com/skycoin/skywire/pkg/snet/arclient" "github.com/skycoin/skywire/pkg/transport" "github.com/skycoin/skywire/pkg/util/updater" + "github.com/skycoin/skywire/pkg/visor/logstore" "github.com/skycoin/skywire/pkg/visor/visorconfig" ) @@ -48,8 +49,9 @@ type Visor struct { reportCh chan vReport closeStack []closeElem - conf *visorconfig.V1 - log *logging.Logger + conf *visorconfig.V1 + log *logging.Logger + logstore logstore.Store startedAt time.Time restartCtx *restart.Context @@ -117,6 +119,13 @@ func (v *Visor) MasterLogger() *logging.MasterLogger { return v.conf.MasterLogger() } +func (v *Visor) setupRuntimeLogStore() { + store := logstore.MakeStore(0) + ml := v.MasterLogger() + ml.AddHook(store.GetHook()) + v.logstore = store +} + // NewVisor constructs new Visor. func NewVisor(conf *visorconfig.V1, restartCtx *restart.Context) (v *Visor, ok bool) { ok = true From 25fddebf315b040a0d1c0f60b160523dadff2511 Mon Sep 17 00:00:00 2001 From: Never M Date: Wed, 14 Apr 2021 11:55:11 +0300 Subject: [PATCH 02/19] Implement log store --- pkg/visor/logstore/logstore.go | 67 +++++++++++++++++++++++++++++++--- pkg/visor/visor.go | 4 +- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index ec807887c6..2fe2091593 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -1,12 +1,69 @@ package logstore -import "github.com/sirupsen/logrus" +import ( + "strings" + "github.com/sirupsen/logrus" +) + +// Store is in-memory log store that returns all logs as a single string type Store interface { - GetLogs() string - GetHook() logrus.Hook + GetLogs() (string, error) +} + +// MakeStore returns a new store that will hold up to max entries, +// overwriting the oldest entry when over the capacity +// returned hook should be registered in logrus master logger to +// store log entries +func MakeStore(max int) (Store, logrus.Hook) { + entries := make([]*logrus.Entry, max) + store := &store{max: int64(max), entries: entries} + return store, store +} + +type store struct { + max int64 + n int64 + entries []*logrus.Entry +} + +// GetLogs returns most resent log lines (up to max log lines is stored) +func (s *store) GetLogs() (string, error) { + if s.n < s.max { + return s.collectLogs(0, s.n) + } + logsWrap, err := s.collectLogs(s.n, s.max) + if err != nil { + return "", err + } + logs, err := s.collectLogs(0, s.n) + if err != nil { + return "", err + } + return logsWrap + logs, nil +} + +// collect log lines into a single string, starting at from (inclusive) +// and ending at to (not inclusive) +func (s *store) collectLogs(from, to int64) (string, error) { + sb := strings.Builder{} + for i := from; i < to; i++ { + line, err := s.entries[i].String() + if err != nil { + return "", err + } + sb.WriteString(line) + } + return sb.String(), nil +} + +func (s *store) Levels() []logrus.Level { + return logrus.AllLevels } -func MakeStore(maxEntries int) Store { - panic("not implemented") +func (s *store) Fire(entry *logrus.Entry) error { + idx := s.n % s.max + s.entries[idx] = entry + s.n++ + return nil } diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 1479d154b5..55944e5474 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -120,9 +120,9 @@ func (v *Visor) MasterLogger() *logging.MasterLogger { } func (v *Visor) setupRuntimeLogStore() { - store := logstore.MakeStore(0) + store, hook := logstore.MakeStore(0) ml := v.MasterLogger() - ml.AddHook(store.GetHook()) + ml.AddHook(hook) v.logstore = store } From 607cae993790824d7681d19b205c6bd07112beed Mon Sep 17 00:00:00 2001 From: Never M Date: Wed, 14 Apr 2021 12:13:14 +0300 Subject: [PATCH 03/19] Add number of overwritten entries to store api --- pkg/visor/logstore/logstore.go | 41 +++++++++++++++++++++------------- pkg/visor/visor.go | 6 ++--- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index 2fe2091593..68d1de465a 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -8,7 +8,13 @@ import ( // Store is in-memory log store that returns all logs as a single string type Store interface { - GetLogs() (string, error) + // get logs returns stored logs and the number of log entries overwritten + // due to insufficient capacity. + // returned number n means that n log entries have been dropped and the oldest + // log entry is (n+1)th + GetLogs() ([]*logrus.Entry, int64) + // get logs as a single string + GetLogStr() (string, error) } // MakeStore returns a new store that will hold up to max entries, @@ -28,31 +34,34 @@ type store struct { } // GetLogs returns most resent log lines (up to max log lines is stored) -func (s *store) GetLogs() (string, error) { +func (s *store) GetLogs() ([]*logrus.Entry, int64) { if s.n < s.max { - return s.collectLogs(0, s.n) + return s.collectLogs(0, s.n), 0 } - logsWrap, err := s.collectLogs(s.n, s.max) - if err != nil { - return "", err - } - logs, err := s.collectLogs(0, s.n) - if err != nil { - return "", err - } - return logsWrap + logs, nil + logs := s.collectLogs(s.n, s.max) + logs = append(logs, s.collectLogs(0, s.n)...) + return logs, s.n - s.max } // collect log lines into a single string, starting at from (inclusive) // and ending at to (not inclusive) -func (s *store) collectLogs(from, to int64) (string, error) { - sb := strings.Builder{} +func (s *store) collectLogs(from, to int64) []*logrus.Entry { + logs := make([]*logrus.Entry, 0) for i := from; i < to; i++ { - line, err := s.entries[i].String() + logs = append(logs, s.entries[i]) + } + return logs +} + +func (s *store) GetLogStr() (string, error) { + logs, _ := s.GetLogs() + var sb strings.Builder + for _, entry := range logs { + s, err := entry.String() if err != nil { return "", err } - sb.WriteString(line) + sb.WriteString(s) } return sb.String(), nil } diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 55944e5474..ee4c11f554 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -120,9 +120,9 @@ func (v *Visor) MasterLogger() *logging.MasterLogger { } func (v *Visor) setupRuntimeLogStore() { - store, hook := logstore.MakeStore(0) - ml := v.MasterLogger() - ml.AddHook(hook) + // todo: add config to change the capacity of in-memory log store + store, hook := logstore.MakeStore(5) + v.MasterLogger().AddHook(hook) v.logstore = store } From 66157b8ede0864066786ed402e0abf917cd19c89 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 15 Apr 2021 10:58:32 +0300 Subject: [PATCH 04/19] Add visor api runtime logs method --- pkg/visor/api.go | 6 ++++++ pkg/visor/rpc.go | 6 ++++++ pkg/visor/rpc_client.go | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/pkg/visor/api.go b/pkg/visor/api.go index 42fdc0e034..e36a53b8da 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -70,6 +70,7 @@ type API interface { UpdateWithStatus(config updater.UpdateConfig) <-chan StatusMessage UpdateAvailable(channel updater.Channel) (*updater.Version, error) UpdateStatus() (string, error) + RuntimeLogs() (string, error) } // HealthCheckable resource returns its health status as an integer @@ -724,3 +725,8 @@ func (v *Visor) UpdateAvailable(channel updater.Channel) (*updater.Version, erro func (v *Visor) UpdateStatus() (string, error) { return v.updater.Status(), nil } + +// RuntimeLogs returns visor runtime logs +func (v *Visor) RuntimeLogs() (string, error) { + return "", nil +} diff --git a/pkg/visor/rpc.go b/pkg/visor/rpc.go index d8c88e9fff..553050f6dd 100644 --- a/pkg/visor/rpc.go +++ b/pkg/visor/rpc.go @@ -538,3 +538,9 @@ func (r *RPC) UpdateStatus(_ *struct{}, status *string) (err error) { *status, err = r.visor.UpdateStatus() return } + +// RuntimeLogs returns visor runtime logs +func (r *RPC) RuntimeLogs(_ *struct{}, logs *string) (err error) { + *logs, err = r.visor.RuntimeLogs() + return +} diff --git a/pkg/visor/rpc_client.go b/pkg/visor/rpc_client.go index 16a0134183..2664ba9a8b 100644 --- a/pkg/visor/rpc_client.go +++ b/pkg/visor/rpc_client.go @@ -331,6 +331,13 @@ func (rc *rpcClient) Update(config updater.UpdateConfig) (bool, error) { return updated, err } +// Update calls Update. +func (rc *rpcClient) RuntimeLogs() (string, error) { + var logs string + err := rc.Call("RuntimeLogs", &struct{}{}, &logs) + return logs, err +} + // StatusMessage defines a status of visor update. type StatusMessage struct { Text string @@ -911,3 +918,8 @@ func (mc *mockRPCClient) UpdateAvailable(_ updater.Channel) (*updater.Version, e func (mc *mockRPCClient) UpdateStatus() (string, error) { return "", nil } + +// UpdateStatus implements API. +func (mc *mockRPCClient) RuntimeLogs() (string, error) { + return "", nil +} From 2ebcadb9761ab660e696e31567421ee67597a6c0 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 15 Apr 2021 11:11:04 +0300 Subject: [PATCH 05/19] Add hypervisor http endpoint for visor logs --- pkg/visor/hypervisor.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/visor/hypervisor.go b/pkg/visor/hypervisor.go index 822773e2f5..71eaf7bafc 100644 --- a/pkg/visor/hypervisor.go +++ b/pkg/visor/hypervisor.go @@ -257,6 +257,7 @@ func (hv *Hypervisor) makeMux() chi.Router { r.Get("/visors/{pk}/update/ws/running", hv.isVisorWSUpdateRunning()) r.Get("/visors/{pk}/update/available", hv.visorUpdateAvailable()) r.Get("/visors/{pk}/update/available/{channel}", hv.visorUpdateAvailable()) + r.Post("/visors/{pk}/runtime-logs", hv.getRuntimeLogs()) }) }) @@ -1304,6 +1305,17 @@ func (hv *Hypervisor) visorUpdateAvailable() http.HandlerFunc { }) } +func (hv *Hypervisor) getRuntimeLogs() http.HandlerFunc { + return hv.withCtx(hv.visorCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) { + logs, err := ctx.API.RuntimeLogs() + if err != nil { + httputil.WriteJSON(w, r, http.StatusInternalServerError, err) + return + } + httputil.WriteJSON(w, r, http.StatusOK, logs) + }) +} + /* <<< Helper functions >>> */ From 52df1e434a31931f7e219184c13b28e73a876e64 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 15 Apr 2021 11:26:37 +0300 Subject: [PATCH 06/19] Fix reading log indexing bug --- pkg/visor/api.go | 2 +- pkg/visor/hypervisor.go | 2 +- pkg/visor/logstore/logstore.go | 5 +++-- pkg/visor/visor.go | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/visor/api.go b/pkg/visor/api.go index e36a53b8da..cd38e005eb 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -728,5 +728,5 @@ func (v *Visor) UpdateStatus() (string, error) { // RuntimeLogs returns visor runtime logs func (v *Visor) RuntimeLogs() (string, error) { - return "", nil + return v.logstore.GetLogStr() } diff --git a/pkg/visor/hypervisor.go b/pkg/visor/hypervisor.go index 71eaf7bafc..6372ed63d2 100644 --- a/pkg/visor/hypervisor.go +++ b/pkg/visor/hypervisor.go @@ -257,7 +257,7 @@ func (hv *Hypervisor) makeMux() chi.Router { r.Get("/visors/{pk}/update/ws/running", hv.isVisorWSUpdateRunning()) r.Get("/visors/{pk}/update/available", hv.visorUpdateAvailable()) r.Get("/visors/{pk}/update/available/{channel}", hv.visorUpdateAvailable()) - r.Post("/visors/{pk}/runtime-logs", hv.getRuntimeLogs()) + r.Get("/visors/{pk}/runtime-logs", hv.getRuntimeLogs()) }) }) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index 68d1de465a..c39cddd1e8 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -38,8 +38,9 @@ func (s *store) GetLogs() ([]*logrus.Entry, int64) { if s.n < s.max { return s.collectLogs(0, s.n), 0 } - logs := s.collectLogs(s.n, s.max) - logs = append(logs, s.collectLogs(0, s.n)...) + idx := s.n % s.max + logs := s.collectLogs(idx, s.max) + logs = append(logs, s.collectLogs(0, idx)...) return logs, s.n - s.max } diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index ee4c11f554..8fd48b44a1 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -143,6 +143,7 @@ func NewVisor(conf *visorconfig.V1, restartCtx *restart.Context) (v *Visor, ok b v.conf.MasterLogger().SetLevel(logLvl) logging.SetLevel(logLvl) } + v.setupRuntimeLogStore() log := v.MasterLogger().PackageLogger("visor:startup") log.WithField("public_key", conf.PK). From 0b83eec804da2b815133f9eb73be9bc4fb3003f4 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 15 Apr 2021 12:03:55 +0300 Subject: [PATCH 07/19] Format logs as json --- pkg/visor/hypervisor.go | 4 +++- pkg/visor/logstore/logstore.go | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/visor/hypervisor.go b/pkg/visor/hypervisor.go index 6372ed63d2..75ce5a16bf 100644 --- a/pkg/visor/hypervisor.go +++ b/pkg/visor/hypervisor.go @@ -1312,7 +1312,9 @@ func (hv *Hypervisor) getRuntimeLogs() http.HandlerFunc { httputil.WriteJSON(w, r, http.StatusInternalServerError, err) return } - httputil.WriteJSON(w, r, http.StatusOK, logs) + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write([]byte(logs)) }) } diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index c39cddd1e8..895f38091f 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -23,14 +23,16 @@ type Store interface { // store log entries func MakeStore(max int) (Store, logrus.Hook) { entries := make([]*logrus.Entry, max) - store := &store{max: int64(max), entries: entries} + formatter := &logrus.JSONFormatter{} + store := &store{max: int64(max), entries: entries, formatter: formatter} return store, store } type store struct { - max int64 - n int64 - entries []*logrus.Entry + max int64 + n int64 + entries []*logrus.Entry + formatter logrus.Formatter } // GetLogs returns most resent log lines (up to max log lines is stored) @@ -58,11 +60,11 @@ func (s *store) GetLogStr() (string, error) { logs, _ := s.GetLogs() var sb strings.Builder for _, entry := range logs { - s, err := entry.String() + bs, err := s.formatter.Format(entry) if err != nil { return "", err } - sb.WriteString(s) + sb.WriteString(string(bs)) } return sb.String(), nil } From 39814fbaf66f81fe8fc68fc50bf6e144bd2b6922 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 15 Apr 2021 13:14:10 +0300 Subject: [PATCH 08/19] Add real line to log entry --- pkg/visor/logstore/logstore.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index 895f38091f..fdaa3484d5 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -6,6 +6,10 @@ import ( "github.com/sirupsen/logrus" ) +// LogRealLineKey is a key in the log enry that denote real log line number +// in the total log (not limited by capacity of runtime log store) +const LogRealLineKey = "real_line" + // Store is in-memory log store that returns all logs as a single string type Store interface { // get logs returns stored logs and the number of log entries overwritten @@ -75,7 +79,8 @@ func (s *store) Levels() []logrus.Level { func (s *store) Fire(entry *logrus.Entry) error { idx := s.n % s.max - s.entries[idx] = entry + e := entry.WithField(LogRealLineKey, s.n) + s.entries[idx] = e s.n++ return nil } From ba51f8f67ef03599fe7319ecdd9bf65f6ae7af51 Mon Sep 17 00:00:00 2001 From: Never M Date: Tue, 20 Apr 2021 17:47:12 +0300 Subject: [PATCH 09/19] Add error check when writing response --- pkg/visor/hypervisor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/visor/hypervisor.go b/pkg/visor/hypervisor.go index 75ce5a16bf..ad5ad181fe 100644 --- a/pkg/visor/hypervisor.go +++ b/pkg/visor/hypervisor.go @@ -1314,7 +1314,10 @@ func (hv *Hypervisor) getRuntimeLogs() http.HandlerFunc { } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - w.Write([]byte(logs)) + _, err = w.Write([]byte(logs)) + if err != nil { + hv.visor.log.Errorf("Cannot write response: %s", err) + } }) } From 8b3f9436619ce84ed8da08b453f24934613ada24 Mon Sep 17 00:00:00 2001 From: Never M Date: Tue, 20 Apr 2021 17:50:42 +0300 Subject: [PATCH 10/19] Add constant for max runtime log entries --- pkg/visor/visor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 8fd48b44a1..6a56c8db00 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -41,6 +41,7 @@ const ( // moduleShutdownTimeout is the timeout given to a module to shutdown cleanly. // Otherwise the shutdown logic will continue and report a timeout error. moduleShutdownTimeout = time.Second * 2 + runtimeLogMaxEntries = 300 ) // Visor provides messaging runtime for Apps by setting up all @@ -121,7 +122,7 @@ func (v *Visor) MasterLogger() *logging.MasterLogger { func (v *Visor) setupRuntimeLogStore() { // todo: add config to change the capacity of in-memory log store - store, hook := logstore.MakeStore(5) + store, hook := logstore.MakeStore(runtimeLogMaxEntries) v.MasterLogger().AddHook(hook) v.logstore = store } From e19101dc32f9411a10edf54220888bbb091c7f31 Mon Sep 17 00:00:00 2001 From: Never M Date: Tue, 20 Apr 2021 17:54:21 +0300 Subject: [PATCH 11/19] Run make format --- cmd/skywire-visor/commands/root.go | 4 +-- go.mod | 1 - go.sum | 31 ++++++++------------ internal/vpn/server.go | 4 +-- pkg/app/appserver/mock_proc_manager.go | 10 +++++-- pkg/app/appserver/mock_rpc_ingress_client.go | 12 +++++--- pkg/visor/api.go | 3 +- pkg/visor/hypervisorconfig/config.go | 2 +- 8 files changed, 34 insertions(+), 33 deletions(-) diff --git a/cmd/skywire-visor/commands/root.go b/cmd/skywire-visor/commands/root.go index c15c926996..07ca6a1be3 100644 --- a/cmd/skywire-visor/commands/root.go +++ b/cmd/skywire-visor/commands/root.go @@ -2,10 +2,8 @@ package commands import ( "context" - "embed" "fmt" "io" - "io/fs" "io/ioutil" "net/http" _ "net/http/pprof" // nolint:gosec // https://golang.org/doc/diagnostics.html#profiling @@ -15,6 +13,7 @@ import ( "syscall" "time" + "embed" "github.com/pkg/profile" "github.com/skycoin/dmsg/buildinfo" "github.com/skycoin/dmsg/cmdutil" @@ -22,6 +21,7 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/spf13/cobra" "github.com/toqueteos/webbrowser" + "io/fs" "github.com/skycoin/skywire/pkg/restart" "github.com/skycoin/skywire/pkg/syslog" diff --git a/go.mod b/go.mod index c129fc3c53..c5957aca74 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,6 @@ require ( github.com/mmcloughlin/avo v0.0.0-20200523190732-4439b6b2c061 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/pkg/profile v1.5.0 - github.com/prometheus/client_golang v1.7.1 // indirect github.com/schollz/progressbar/v2 v2.15.0 github.com/shirou/gopsutil v2.20.5+incompatible github.com/sirupsen/logrus v1.7.0 diff --git a/go.sum b/go.sum index f025f1c1b4..59905b3036 100644 --- a/go.sum +++ b/go.sum @@ -8,9 +8,7 @@ github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrU github.com/VictoriaMetrics/metrics v1.12.3 h1:Fe6JHC6MSEKa+BtLhPN8WIvS+HKPzMc2evEpNeCGy7I= github.com/VictoriaMetrics/metrics v1.12.3/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/andybalholm/brotli v0.0.0-20190621154722-5f990b63d2d6 h1:bZ28Hqta7TFAK3Q08CMvv8y3/8ATaEqv2nGoc6yff6c= github.com/andybalholm/brotli v0.0.0-20190621154722-5f990b63d2d6/go.mod h1:+lx6/Aqd1kLJ1GQfkvOnaZ1WGmLpMpbprPuIOOZX30U= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= @@ -18,9 +16,7 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -46,15 +42,17 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec= github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-redis/redis v6.15.6+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -65,13 +63,13 @@ github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4er github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -79,6 +77,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= @@ -91,6 +90,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -100,7 +100,6 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= @@ -122,8 +121,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kz/discordrus v1.2.0 h1:r5uplKozPR+TIJ1NUZT758Lv7eukf8+fp3L4uRj+6xs= github.com/kz/discordrus v1.2.0/go.mod h1:cJ3TiJUUuY5Gm3DNYHnnaUa3iol8VBRPzztAeZm7exc= @@ -172,19 +173,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -258,6 +252,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg= github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE= +github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lLQwDsRyZfmkPeRbdgPtW609es+/9E= github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -279,6 +274,7 @@ golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcm golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -287,7 +283,6 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191204025024-5ee1b9f4859a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -311,13 +306,11 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs= golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -328,6 +321,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -352,10 +346,12 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -365,7 +361,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/vpn/server.go b/internal/vpn/server.go index 11f356826e..1058560607 100644 --- a/internal/vpn/server.go +++ b/internal/vpn/server.go @@ -7,9 +7,9 @@ import ( "net" "sync" - "github.com/skycoin/skywire/pkg/util/netutil" - "github.com/sirupsen/logrus" + + "github.com/skycoin/skywire/pkg/util/netutil" ) // Server is a VPN server. diff --git a/pkg/app/appserver/mock_proc_manager.go b/pkg/app/appserver/mock_proc_manager.go index 18464af453..b4c6cc568d 100644 --- a/pkg/app/appserver/mock_proc_manager.go +++ b/pkg/app/appserver/mock_proc_manager.go @@ -2,9 +2,13 @@ package appserver -import appcommon "github.com/skycoin/skywire/pkg/app/appcommon" -import mock "github.com/stretchr/testify/mock" -import net "net" +import ( + net "net" + + mock "github.com/stretchr/testify/mock" + + appcommon "github.com/skycoin/skywire/pkg/app/appcommon" +) // MockProcManager is an autogenerated mock type for the ProcManager type type MockProcManager struct { diff --git a/pkg/app/appserver/mock_rpc_ingress_client.go b/pkg/app/appserver/mock_rpc_ingress_client.go index 7df2b996d6..4f989a2db6 100644 --- a/pkg/app/appserver/mock_rpc_ingress_client.go +++ b/pkg/app/appserver/mock_rpc_ingress_client.go @@ -2,10 +2,14 @@ package appserver -import appnet "github.com/skycoin/skywire/pkg/app/appnet" -import mock "github.com/stretchr/testify/mock" -import routing "github.com/skycoin/skywire/pkg/routing" -import time "time" +import ( + time "time" + + mock "github.com/stretchr/testify/mock" + + appnet "github.com/skycoin/skywire/pkg/app/appnet" + routing "github.com/skycoin/skywire/pkg/routing" +) // MockRPCIngressClient is an autogenerated mock type for the RPCIngressClient type type MockRPCIngressClient struct { diff --git a/pkg/visor/api.go b/pkg/visor/api.go index cd38e005eb..85a3a98516 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -11,8 +11,6 @@ import ( "sync" "time" - "github.com/skycoin/skywire/pkg/util/netutil" - "github.com/google/uuid" "github.com/skycoin/dmsg/buildinfo" "github.com/skycoin/dmsg/cipher" @@ -22,6 +20,7 @@ import ( "github.com/skycoin/skywire/pkg/routing" "github.com/skycoin/skywire/pkg/skyenv" "github.com/skycoin/skywire/pkg/transport" + "github.com/skycoin/skywire/pkg/util/netutil" "github.com/skycoin/skywire/pkg/util/updater" "github.com/skycoin/skywire/pkg/visor/dmsgtracker" ) diff --git a/pkg/visor/hypervisorconfig/config.go b/pkg/visor/hypervisorconfig/config.go index 637e815a89..706f2a162d 100644 --- a/pkg/visor/hypervisorconfig/config.go +++ b/pkg/visor/hypervisorconfig/config.go @@ -3,7 +3,6 @@ package hypervisorconfig import ( "encoding/hex" "encoding/json" - "io/fs" "log" "net/http" "os" @@ -11,6 +10,7 @@ import ( "time" "github.com/skycoin/dmsg/cipher" + "io/fs" "github.com/skycoin/skywire/pkg/skyenv" "github.com/skycoin/skywire/pkg/util/pathutil" From ba2c70de6bf343469f1438dc8be89ec7292eacb8 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 22 Apr 2021 13:14:47 +0300 Subject: [PATCH 12/19] Fix goimorts lint error --- cmd/skywire-visor/commands/root.go | 3 ++- pkg/visor/hypervisorconfig/config.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/skywire-visor/commands/root.go b/cmd/skywire-visor/commands/root.go index 07ca6a1be3..341c8b8fdf 100644 --- a/cmd/skywire-visor/commands/root.go +++ b/cmd/skywire-visor/commands/root.go @@ -14,6 +14,8 @@ import ( "time" "embed" + "io/fs" + "github.com/pkg/profile" "github.com/skycoin/dmsg/buildinfo" "github.com/skycoin/dmsg/cmdutil" @@ -21,7 +23,6 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/spf13/cobra" "github.com/toqueteos/webbrowser" - "io/fs" "github.com/skycoin/skywire/pkg/restart" "github.com/skycoin/skywire/pkg/syslog" diff --git a/pkg/visor/hypervisorconfig/config.go b/pkg/visor/hypervisorconfig/config.go index 706f2a162d..1b165cc331 100644 --- a/pkg/visor/hypervisorconfig/config.go +++ b/pkg/visor/hypervisorconfig/config.go @@ -9,9 +9,10 @@ import ( "path/filepath" "time" - "github.com/skycoin/dmsg/cipher" "io/fs" + "github.com/skycoin/dmsg/cipher" + "github.com/skycoin/skywire/pkg/skyenv" "github.com/skycoin/skywire/pkg/util/pathutil" ) From 76eae8222bf5858075f9d4189007f27debf46fa8 Mon Sep 17 00:00:00 2001 From: Never M Date: Mon, 26 Apr 2021 18:56:36 +0300 Subject: [PATCH 13/19] Refactor names and add comments --- pkg/visor/logstore/logstore.go | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index fdaa3484d5..186d6425f2 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -28,26 +28,28 @@ type Store interface { func MakeStore(max int) (Store, logrus.Hook) { entries := make([]*logrus.Entry, max) formatter := &logrus.JSONFormatter{} - store := &store{max: int64(max), entries: entries, formatter: formatter} + store := &store{cap: int64(max), entries: entries, formatter: formatter} return store, store } type store struct { - max int64 - n int64 + // max number of entries to hold simultaneously + cap int64 + // number of the next entry to come (also number of entries processed since the beginning) + entryNum int64 entries []*logrus.Entry formatter logrus.Formatter } -// GetLogs returns most resent log lines (up to max log lines is stored) +// GetLogs returns most resent log lines (up to cap log lines is stored) func (s *store) GetLogs() ([]*logrus.Entry, int64) { - if s.n < s.max { - return s.collectLogs(0, s.n), 0 + if s.entryNum < s.cap { + return s.collectLogs(0, s.entryNum), 0 } - idx := s.n % s.max - logs := s.collectLogs(idx, s.max) + idx := s.entryNum % s.cap + logs := s.collectLogs(idx, s.cap) logs = append(logs, s.collectLogs(0, idx)...) - return logs, s.n - s.max + return logs, s.entryNum - s.cap } // collect log lines into a single string, starting at from (inclusive) @@ -60,6 +62,8 @@ func (s *store) collectLogs(from, to int64) []*logrus.Entry { return logs } +// GetLogStr returns logs as a single string +// log entries are formatted with store formatter and concatenated together func (s *store) GetLogStr() (string, error) { logs, _ := s.GetLogs() var sb strings.Builder @@ -73,14 +77,18 @@ func (s *store) GetLogStr() (string, error) { return sb.String(), nil } +// Levels implements logrus.Hook interface. It denotes log levels +// that we are interested in func (s *store) Levels() []logrus.Level { return logrus.AllLevels } +// Fire implements logrus.Hook interface to process new log entry +// that we simply store func (s *store) Fire(entry *logrus.Entry) error { - idx := s.n % s.max - e := entry.WithField(LogRealLineKey, s.n) + idx := s.entryNum % s.cap + e := entry.WithField(LogRealLineKey, s.entryNum) s.entries[idx] = e - s.n++ + s.entryNum++ return nil } From 8ff25717cffed865ce8b8f9221e8b6507d4fca23 Mon Sep 17 00:00:00 2001 From: Never M Date: Wed, 5 May 2021 11:04:25 +0300 Subject: [PATCH 14/19] Store log entries as strings --- pkg/visor/api.go | 3 +- pkg/visor/logstore/logstore.go | 55 +++++++++++++--------------------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/pkg/visor/api.go b/pkg/visor/api.go index 85a3a98516..cef87dc95b 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -727,5 +727,6 @@ func (v *Visor) UpdateStatus() (string, error) { // RuntimeLogs returns visor runtime logs func (v *Visor) RuntimeLogs() (string, error) { - return v.logstore.GetLogStr() + logs, _ := v.logstore.GetLogs() + return strings.Join(logs, "\n"), nil } diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index 186d6425f2..4285e063bd 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -1,8 +1,6 @@ package logstore import ( - "strings" - "github.com/sirupsen/logrus" ) @@ -16,9 +14,7 @@ type Store interface { // due to insufficient capacity. // returned number n means that n log entries have been dropped and the oldest // log entry is (n+1)th - GetLogs() ([]*logrus.Entry, int64) - // get logs as a single string - GetLogStr() (string, error) + GetLogs() ([]string, int64) } // MakeStore returns a new store that will hold up to max entries, @@ -26,8 +22,8 @@ type Store interface { // returned hook should be registered in logrus master logger to // store log entries func MakeStore(max int) (Store, logrus.Hook) { - entries := make([]*logrus.Entry, max) - formatter := &logrus.JSONFormatter{} + entries := make([]string, max) + formatter := &logrus.TextFormatter{DisableColors: true} store := &store{cap: int64(max), entries: entries, formatter: formatter} return store, store } @@ -37,44 +33,29 @@ type store struct { cap int64 // number of the next entry to come (also number of entries processed since the beginning) entryNum int64 - entries []*logrus.Entry + entries []string formatter logrus.Formatter } -// GetLogs returns most resent log lines (up to cap log lines is stored) -func (s *store) GetLogs() ([]*logrus.Entry, int64) { - if s.entryNum < s.cap { - return s.collectLogs(0, s.entryNum), 0 - } - idx := s.entryNum % s.cap - logs := s.collectLogs(idx, s.cap) - logs = append(logs, s.collectLogs(0, idx)...) - return logs, s.entryNum - s.cap -} - // collect log lines into a single string, starting at from (inclusive) // and ending at to (not inclusive) -func (s *store) collectLogs(from, to int64) []*logrus.Entry { - logs := make([]*logrus.Entry, 0) +func (s *store) collectLogs(from, to int64) []string { + logs := make([]string, 0) for i := from; i < to; i++ { logs = append(logs, s.entries[i]) } return logs } -// GetLogStr returns logs as a single string -// log entries are formatted with store formatter and concatenated together -func (s *store) GetLogStr() (string, error) { - logs, _ := s.GetLogs() - var sb strings.Builder - for _, entry := range logs { - bs, err := s.formatter.Format(entry) - if err != nil { - return "", err - } - sb.WriteString(string(bs)) +// GetLogs returns most resent log lines (up to cap log lines is stored) +func (s *store) GetLogs() ([]string, int64) { + if s.entryNum < s.cap { + return s.collectLogs(0, s.entryNum), 0 } - return sb.String(), nil + idx := s.entryNum % s.cap + logs := s.collectLogs(idx, s.cap) + logs = append(logs, s.collectLogs(0, idx)...) + return logs, s.entryNum - s.cap } // Levels implements logrus.Hook interface. It denotes log levels @@ -87,8 +68,12 @@ func (s *store) Levels() []logrus.Level { // that we simply store func (s *store) Fire(entry *logrus.Entry) error { idx := s.entryNum % s.cap - e := entry.WithField(LogRealLineKey, s.entryNum) - s.entries[idx] = e + e := entry.WithField(LogRealLineKey, s.entryNum).WithField("level", entry.Level.String()) + bs, err := s.formatter.Format(e) + if err != nil { + return err + } + s.entries[idx] = string(bs) s.entryNum++ return nil } From 6b55760dc1e7f4b0ec6ca7f7208c37b4d615a315 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 6 May 2021 12:19:07 +0300 Subject: [PATCH 15/19] Fix log level always beng panic --- pkg/visor/api.go | 2 +- pkg/visor/logstore/logstore.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/visor/api.go b/pkg/visor/api.go index cef87dc95b..7fb81f098f 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -728,5 +728,5 @@ func (v *Visor) UpdateStatus() (string, error) { // RuntimeLogs returns visor runtime logs func (v *Visor) RuntimeLogs() (string, error) { logs, _ := v.logstore.GetLogs() - return strings.Join(logs, "\n"), nil + return strings.Join(logs, ""), nil } diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index 4285e063bd..d5fdc9ac5b 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -6,7 +6,7 @@ import ( // LogRealLineKey is a key in the log enry that denote real log line number // in the total log (not limited by capacity of runtime log store) -const LogRealLineKey = "real_line" +const LogRealLineKey = "log_line" // Store is in-memory log store that returns all logs as a single string type Store interface { @@ -68,7 +68,9 @@ func (s *store) Levels() []logrus.Level { // that we simply store func (s *store) Fire(entry *logrus.Entry) error { idx := s.entryNum % s.cap - e := entry.WithField(LogRealLineKey, s.entryNum).WithField("level", entry.Level.String()) + e := entry.WithField(LogRealLineKey, s.entryNum) + e.Level = entry.Level + e.Message = entry.Message bs, err := s.formatter.Format(e) if err != nil { return err From aec73bf472178fd5f57444d6f4258dc7e53bce16 Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 6 May 2021 12:34:46 +0300 Subject: [PATCH 16/19] Move logstore hook init into root command --- cmd/skywire-visor/commands/root.go | 8 ++++++-- pkg/visor/visor.go | 14 +++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/skywire-visor/commands/root.go b/cmd/skywire-visor/commands/root.go index 341c8b8fdf..284d56967f 100644 --- a/cmd/skywire-visor/commands/root.go +++ b/cmd/skywire-visor/commands/root.go @@ -27,6 +27,7 @@ import ( "github.com/skycoin/skywire/pkg/restart" "github.com/skycoin/skywire/pkg/syslog" "github.com/skycoin/skywire/pkg/visor" + "github.com/skycoin/skywire/pkg/visor/logstore" "github.com/skycoin/skywire/pkg/visor/visorconfig" ) @@ -35,7 +36,8 @@ var uiAssets fs.FS var restartCtx = restart.CaptureContext() const ( - defaultConfigName = "skywire-config.json" + defaultConfigName = "skywire-config.json" + runtimeLogMaxEntries = 300 ) var ( @@ -63,7 +65,8 @@ var rootCmd = &cobra.Command{ Short: "Skywire visor", Run: func(_ *cobra.Command, args []string) { log := initLogger(tag, syslogAddr) - + store, hook := logstore.MakeStore(runtimeLogMaxEntries) + log.AddHook(hook) if discordWebhookURL := discord.GetWebhookURLFromEnv(); discordWebhookURL != "" { // Workaround for Discord logger hook. Actually, it's Info. log.Error(discord.StartLogMessage) @@ -128,6 +131,7 @@ var rootCmd = &cobra.Command{ if !ok { log.Fatal("Failed to start visor.") } + v.SetLogstore(store) if launchBrowser { runBrowser(conf, log) diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 6a56c8db00..3cdaaefc35 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -41,7 +41,6 @@ const ( // moduleShutdownTimeout is the timeout given to a module to shutdown cleanly. // Otherwise the shutdown logic will continue and report a timeout error. moduleShutdownTimeout = time.Second * 2 - runtimeLogMaxEntries = 300 ) // Visor provides messaging runtime for Apps by setting up all @@ -120,13 +119,6 @@ func (v *Visor) MasterLogger() *logging.MasterLogger { return v.conf.MasterLogger() } -func (v *Visor) setupRuntimeLogStore() { - // todo: add config to change the capacity of in-memory log store - store, hook := logstore.MakeStore(runtimeLogMaxEntries) - v.MasterLogger().AddHook(hook) - v.logstore = store -} - // NewVisor constructs new Visor. func NewVisor(conf *visorconfig.V1, restartCtx *restart.Context) (v *Visor, ok bool) { ok = true @@ -144,7 +136,6 @@ func NewVisor(conf *visorconfig.V1, restartCtx *restart.Context) (v *Visor, ok b v.conf.MasterLogger().SetLevel(logLvl) logging.SetLevel(logLvl) } - v.setupRuntimeLogStore() log := v.MasterLogger().PackageLogger("visor:startup") log.WithField("public_key", conf.PK). @@ -223,6 +214,11 @@ func (v *Visor) Close() error { return nil } +// SetLogstore sets visor runtime logstore +func (v *Visor) SetLogstore(store logstore.Store) { + v.logstore = store +} + // tpDiscClient is a convenience function to obtain transport discovery client. func (v *Visor) tpDiscClient() transport.DiscoveryClient { return v.tpM.Conf.DiscoveryClient From d1afc948af8409ca155a97831347aa706df3199f Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 6 May 2021 12:59:16 +0300 Subject: [PATCH 17/19] Use json formatter --- pkg/visor/logstore/logstore.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index d5fdc9ac5b..f1944d303e 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -23,7 +23,7 @@ type Store interface { // store log entries func MakeStore(max int) (Store, logrus.Hook) { entries := make([]string, max) - formatter := &logrus.TextFormatter{DisableColors: true} + formatter := &logrus.JSONFormatter{} store := &store{cap: int64(max), entries: entries, formatter: formatter} return store, store } @@ -68,7 +68,7 @@ func (s *store) Levels() []logrus.Level { // that we simply store func (s *store) Fire(entry *logrus.Entry) error { idx := s.entryNum % s.cap - e := entry.WithField(LogRealLineKey, s.entryNum) + e := entry.WithField(LogRealLineKey, s.entryNum+1) e.Level = entry.Level e.Message = entry.Message bs, err := s.formatter.Format(e) From e23b7472bd5d45b84cbf52a9e6628df3d4812a8f Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 6 May 2021 13:13:27 +0300 Subject: [PATCH 18/19] Fix invalid json for runtime log response --- pkg/visor/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/visor/api.go b/pkg/visor/api.go index 7fb81f098f..d517899fbd 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -727,6 +727,10 @@ func (v *Visor) UpdateStatus() (string, error) { // RuntimeLogs returns visor runtime logs func (v *Visor) RuntimeLogs() (string, error) { + var builder strings.Builder + builder.WriteString("[") logs, _ := v.logstore.GetLogs() - return strings.Join(logs, ""), nil + builder.WriteString(strings.Join(logs, ",")) + builder.WriteString("]") + return builder.String(), nil } From 9f569de5a58ac9181e16f9fb030ab259b1d1987a Mon Sep 17 00:00:00 2001 From: Never M Date: Thu, 6 May 2021 14:29:20 +0300 Subject: [PATCH 19/19] Fix spelling errors --- pkg/visor/logstore/logstore.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/visor/logstore/logstore.go b/pkg/visor/logstore/logstore.go index f1944d303e..c9e06438a7 100644 --- a/pkg/visor/logstore/logstore.go +++ b/pkg/visor/logstore/logstore.go @@ -4,7 +4,7 @@ import ( "github.com/sirupsen/logrus" ) -// LogRealLineKey is a key in the log enry that denote real log line number +// LogRealLineKey is a key in the log entry that denotes real log line number // in the total log (not limited by capacity of runtime log store) const LogRealLineKey = "log_line" @@ -47,7 +47,7 @@ func (s *store) collectLogs(from, to int64) []string { return logs } -// GetLogs returns most resent log lines (up to cap log lines is stored) +// GetLogs returns most recent log lines (up to cap log lines is stored func (s *store) GetLogs() ([]string, int64) { if s.entryNum < s.cap { return s.collectLogs(0, s.entryNum), 0