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)) } diff --git a/core/aggregator/netsample/sample.go b/core/aggregator/netsample/sample.go index 48b634930..6998f6dda 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) GetUserDurationMicroseconds() 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) GetConnectTimeMicroseconds() int { + return s.get(keyConnectMicro) +} + func (s *Sample) SetSendTime(d time.Duration) { s.setDuration(keySendMicro, d) } +func (s *Sample) GetSendTimeMicroseconds() int { + return s.get(keySendMicro) +} + func (s *Sample) SetLatency(d time.Duration) { s.setDuration(keyLatencyMicro, d) } +func (s *Sample) GetLatencyMicroseconds() int { + return s.get(keyLatencyMicro) +} + func (s *Sample) SetReceiveTime(d time.Duration) { s.setDuration(keyReceiveMicro, d) } +func (s *Sample) GetReceiveTimeMicroseconds() 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)) }