From 4c996542067ae7e7250a0f2f18b6d7cd1557769a Mon Sep 17 00:00:00 2001 From: IvanZ <79854463009@yandex.ru> Date: Wed, 4 Sep 2024 11:29:17 +0300 Subject: [PATCH 1/5] Add geters for netsample --- core/aggregator/netsample/sample.go | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index 48b634930..2919775f3 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -90,38 +90,73 @@ func (s *Sample) SetUserDuration(d time.Duration) { s.setDuration(keyRTTMicro, d) } +func (s *Sample) GetUserDuration() int { + return s.get(keyRTTMicro) +} func (s *Sample) SetUserProto(code int) { s.set(keyProtoCode, code) } +func (s *Sample) GetUserProto() int { + return s.get(keyProtoCode) +} + func (s *Sample) SetUserNet(code int) { s.set(keyErrno, code) } +func (s *Sample) GetUserNet() int { + return s.get(keyErrno) +} + func (s *Sample) SetConnectTime(d time.Duration) { s.setDuration(keyConnectMicro, d) } +func (s *Sample) GetConnectTime() int { + return s.get(keyConnectMicro) +} + func (s *Sample) SetSendTime(d time.Duration) { s.setDuration(keySendMicro, d) } +func (s *Sample) GetSendTime() int { + return s.get(keySendMicro) +} + func (s *Sample) SetLatency(d time.Duration) { s.setDuration(keyLatencyMicro, d) } +func (s *Sample) GetLatency() int { + return s.get(keyLatencyMicro) +} + func (s *Sample) SetReceiveTime(d time.Duration) { s.setDuration(keyReceiveMicro, d) } +func (s *Sample) GetReceiveTime() int { + return s.get(keyReceiveMicro) +} + func (s *Sample) SetRequestBytes(b int) { s.set(keyRequestBytes, b) } +func (s *Sample) GetRequestBytes() int { + return s.get(keyRequestBytes) +} + func (s *Sample) SetResponseBytes(b int) { s.set(keyResponseBytes, b) } +func (s *Sample) GetResponseBytes() int { + return s.get(keyResponseBytes) +} + func (s *Sample) String() string { return string(appendPhout(s, nil, true)) } From 50e3d509d8e449b333d9abe38326c2b37392b59b Mon Sep 17 00:00:00 2001 From: IvanZ <79854463009@yandex.ru> Date: Wed, 4 Sep 2024 14:57:51 +0300 Subject: [PATCH 2/5] rename function for fix --- core/aggregator/netsample/sample.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index 2919775f3..b3895de9e 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -90,7 +90,7 @@ func (s *Sample) SetUserDuration(d time.Duration) { s.setDuration(keyRTTMicro, d) } -func (s *Sample) GetUserDuration() int { +func (s *Sample) GetUserDurationMiliseconds() int { return s.get(keyRTTMicro) } func (s *Sample) SetUserProto(code int) { From 42e43bec4dd4d219e37cbef548f06bd8360458c9 Mon Sep 17 00:00:00 2001 From: IvanZ <79854463009@yandex.ru> Date: Wed, 4 Sep 2024 15:20:44 +0300 Subject: [PATCH 3/5] rename function for fix --- core/aggregator/netsample/sample.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index b3895de9e..cc031a7b8 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -90,7 +90,7 @@ func (s *Sample) SetUserDuration(d time.Duration) { s.setDuration(keyRTTMicro, d) } -func (s *Sample) GetUserDurationMiliseconds() int { +func (s *Sample) GetUserDurationMilliseconds() int { return s.get(keyRTTMicro) } func (s *Sample) SetUserProto(code int) { From bf5140441470b2f1c708f121f4473333b3bdf36d Mon Sep 17 00:00:00 2001 From: Nikolai Samokhin Date: Thu, 5 Sep 2024 15:46:20 +0300 Subject: [PATCH 4/5] rename duration and time setters for netsample struct --- core/aggregator/netsample/sample.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index cc031a7b8..6998f6dda 100644 --- a/core/aggregator/netsample/sample.go +++ b/core/aggregator/netsample/sample.go @@ -90,7 +90,7 @@ func (s *Sample) SetUserDuration(d time.Duration) { s.setDuration(keyRTTMicro, d) } -func (s *Sample) GetUserDurationMilliseconds() int { +func (s *Sample) GetUserDurationMicroseconds() int { return s.get(keyRTTMicro) } func (s *Sample) SetUserProto(code int) { @@ -113,7 +113,7 @@ func (s *Sample) SetConnectTime(d time.Duration) { s.setDuration(keyConnectMicro, d) } -func (s *Sample) GetConnectTime() int { +func (s *Sample) GetConnectTimeMicroseconds() int { return s.get(keyConnectMicro) } @@ -121,7 +121,7 @@ func (s *Sample) SetSendTime(d time.Duration) { s.setDuration(keySendMicro, d) } -func (s *Sample) GetSendTime() int { +func (s *Sample) GetSendTimeMicroseconds() int { return s.get(keySendMicro) } @@ -129,7 +129,7 @@ func (s *Sample) SetLatency(d time.Duration) { s.setDuration(keyLatencyMicro, d) } -func (s *Sample) GetLatency() int { +func (s *Sample) GetLatencyMicroseconds() int { return s.get(keyLatencyMicro) } @@ -137,7 +137,7 @@ func (s *Sample) SetReceiveTime(d time.Duration) { s.setDuration(keyReceiveMicro, d) } -func (s *Sample) GetReceiveTime() int { +func (s *Sample) GetReceiveTimeMicroseconds() int { return s.get(keyReceiveMicro) } From c95255a02d2127f80669ab541d9c67bcb8e9b7d8 Mon Sep 17 00:00:00 2001 From: IvanZ <79854463009@yandex.ru> Date: Tue, 10 Sep 2024 11:58:16 +0300 Subject: [PATCH 5/5] refactoring code for update golang version --- cli/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 350cda29a..36fb7c646 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -5,7 +5,7 @@ import ( "context" "flag" "fmt" - "io/ioutil" + "io" "net/http" "os" "os/signal" @@ -221,7 +221,7 @@ func readConfig(args []string) *CliConfig { log.Info("Pandora version", zap.String("version", Version)) if useStdinConfig { v.SetConfigType("yaml") - configBuffer, err := ioutil.ReadAll(bufio.NewReader(os.Stdin)) + configBuffer, err := io.ReadAll(bufio.NewReader(os.Stdin)) if err != nil { log.Fatal("Cannot read from standard input", zap.Error(err)) }