From f96c6e704582614029124ea50487690a80b2b7e3 Mon Sep 17 00:00:00 2001 From: Ficoto <438500829@qq.com> Date: Sat, 8 May 2021 12:14:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B9=E6=88=90=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E7=94=A8kratos=E7=9A=84=E7=BB=84=E4=BB=B6=EF=BC=8Climiter?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cpukit/README.md | 7 - cpukit/cgroup.go | 126 --------- cpukit/cgroupCPU.go | 250 ------------------ cpukit/cgroup_test.go | 11 - cpukit/cpu.go | 68 ----- cpukit/cpu_test.go | 22 -- cpukit/psutilCPU.go | 45 ---- cpukit/stat_test.go | 20 -- cpukit/util.go | 121 --------- go.mod | 7 +- go.sum | 180 ++++++++++++- group/README.md | 12 - group/example_test.go | 46 ---- group/group.go | 64 ----- group/group_test.go | 65 ----- metric/counter.go | 84 ------ metric/counter_test.go | 47 ---- metric/gauge.go | 94 ------- metric/gauge_test.go | 23 -- metric/histogram.go | 50 ---- metric/iterator.go | 26 -- metric/metric.go | 104 -------- metric/point_gauge.go | 61 ----- metric/point_gauge_test.go | 55 ---- metric/point_policy.go | 57 ---- metric/reduce.go | 77 ------ metric/reduce_test.go | 17 -- metric/rolling_counter.go | 75 ------ metric/rolling_counter_test.go | 156 ----------- metric/rolling_gauge.go | 62 ----- metric/rolling_gauge_test.go | 192 -------------- metric/rolling_policy.go | 100 ------- metric/rolling_policy_test.go | 67 ----- metric/window.go | 107 -------- metric/window_test.go | 68 ----- ratelimiter/bbr/bbr.go | 13 +- .../limitermiddleware/gin_middleware.go | 2 +- 37 files changed, 185 insertions(+), 2396 deletions(-) delete mode 100644 cpukit/README.md delete mode 100644 cpukit/cgroup.go delete mode 100644 cpukit/cgroupCPU.go delete mode 100644 cpukit/cgroup_test.go delete mode 100644 cpukit/cpu.go delete mode 100644 cpukit/cpu_test.go delete mode 100644 cpukit/psutilCPU.go delete mode 100644 cpukit/stat_test.go delete mode 100644 cpukit/util.go delete mode 100644 group/README.md delete mode 100644 group/example_test.go delete mode 100644 group/group.go delete mode 100644 group/group_test.go delete mode 100644 metric/counter.go delete mode 100644 metric/counter_test.go delete mode 100644 metric/gauge.go delete mode 100644 metric/gauge_test.go delete mode 100644 metric/histogram.go delete mode 100644 metric/iterator.go delete mode 100644 metric/metric.go delete mode 100644 metric/point_gauge.go delete mode 100644 metric/point_gauge_test.go delete mode 100644 metric/point_policy.go delete mode 100644 metric/reduce.go delete mode 100644 metric/reduce_test.go delete mode 100644 metric/rolling_counter.go delete mode 100644 metric/rolling_counter_test.go delete mode 100644 metric/rolling_gauge.go delete mode 100644 metric/rolling_gauge_test.go delete mode 100644 metric/rolling_policy.go delete mode 100644 metric/rolling_policy_test.go delete mode 100644 metric/window.go delete mode 100644 metric/window_test.go diff --git a/cpukit/README.md b/cpukit/README.md deleted file mode 100644 index 1028e9e..0000000 --- a/cpukit/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## stat/sys - -System Information - -## 项目简介 - -获取Linux平台下的系统信息,包括cpu主频、cpu使用率等 diff --git a/cpukit/cgroup.go b/cpukit/cgroup.go deleted file mode 100644 index e302f06..0000000 --- a/cpukit/cgroup.go +++ /dev/null @@ -1,126 +0,0 @@ -package cpukit - -import ( - "bufio" - "fmt" - "io" - "os" - "path" - "strconv" - "strings" -) - -const cgroupRootDir = "/sys/fs/cgroup" - -// cgroup Linux cgroup -type cgroup struct { - cgroupSet map[string]string -} - -// CPUCFSQuotaUs cpu.cfs_quota_us -func (c *cgroup) CPUCFSQuotaUs() (int64, error) { - data, err := readFile(path.Join(c.cgroupSet["cpu"], "cpu.cfs_quota_us")) - if err != nil { - return 0, err - } - return strconv.ParseInt(data, 10, 64) -} - -// CPUCFSPeriodUs cpu.cfs_period_us -func (c *cgroup) CPUCFSPeriodUs() (uint64, error) { - data, err := readFile(path.Join(c.cgroupSet["cpu"], "cpu.cfs_period_us")) - if err != nil { - return 0, err - } - return parseUint(data) -} - -// CPUAcctUsage cpuacct.usage -func (c *cgroup) CPUAcctUsage() (uint64, error) { - data, err := readFile(path.Join(c.cgroupSet["cpuacct"], "cpuacct.usage")) - if err != nil { - return 0, err - } - return parseUint(data) -} - -// CPUAcctUsagePerCPU cpuacct.usage_percpu -func (c *cgroup) CPUAcctUsagePerCPU() ([]uint64, error) { - data, err := readFile(path.Join(c.cgroupSet["cpuacct"], "cpuacct.usage_percpu")) - if err != nil { - return nil, err - } - var usage []uint64 - for _, v := range strings.Fields(string(data)) { - var u uint64 - if u, err = parseUint(v); err != nil { - return nil, err - } - // fix possible_cpu:https://www.ibm.com/support/knowledgecenter/en/linuxonibm/com.ibm.linux.z.lgdd/lgdd_r_posscpusparm.html - if u != 0 { - usage = append(usage, u) - } - } - return usage, nil -} - -// CPUSetCPUs cpuset.cpus -func (c *cgroup) CPUSetCPUs() ([]uint64, error) { - data, err := readFile(path.Join(c.cgroupSet["cpuset"], "cpuset.cpus")) - if err != nil { - return nil, err - } - cpus, err := ParseUintList(data) - if err != nil { - return nil, err - } - var sets []uint64 - for k := range cpus { - sets = append(sets, uint64(k)) - } - return sets, nil -} - -// CurrentcGroup get current process cgroup -func currentcGroup() (*cgroup, error) { - pid := os.Getpid() - cgroupFile := fmt.Sprintf("/proc/%d/cgroup", pid) - cgroupSet := make(map[string]string) - fp, err := os.Open(cgroupFile) - if err != nil { - return nil, err - } - defer fp.Close() - buf := bufio.NewReader(fp) - for { - line, err := buf.ReadString('\n') - if err != nil { - if err == io.EOF { - break - } - return nil, err - } - col := strings.Split(strings.TrimSpace(line), ":") - if len(col) != 3 { - return nil, fmt.Errorf("invalid cgroup format %s", line) - } - dir := col[2] - // When dir is not equal to /, it must be in docker - if dir != "/" { - cgroupSet[col[1]] = path.Join(cgroupRootDir, col[1]) - if strings.Contains(col[1], ",") { - for _, k := range strings.Split(col[1], ",") { - cgroupSet[k] = path.Join(cgroupRootDir, k) - } - } - } else { - cgroupSet[col[1]] = path.Join(cgroupRootDir, col[1], col[2]) - if strings.Contains(col[1], ",") { - for _, k := range strings.Split(col[1], ",") { - cgroupSet[k] = path.Join(cgroupRootDir, k, col[2]) - } - } - } - } - return &cgroup{cgroupSet: cgroupSet}, nil -} diff --git a/cpukit/cgroupCPU.go b/cpukit/cgroupCPU.go deleted file mode 100644 index 86741bc..0000000 --- a/cpukit/cgroupCPU.go +++ /dev/null @@ -1,250 +0,0 @@ -package cpukit - -import ( - "bufio" - "fmt" - "os" - "strconv" - "strings" - - "github.com/pkg/errors" - pscpu "github.com/shirou/gopsutil/cpu" -) - -type cgroupCPU struct { - frequency uint64 - quota float64 - cores uint64 - - preSystem uint64 - preTotal uint64 - usage uint64 -} - -func newCgroupCPU() (cpu *cgroupCPU, err error) { - var cores int - cores, err = pscpu.Counts(true) - if err != nil || cores == 0 { - var cpus []uint64 - cpus, err = perCPUUsage() - if err != nil { - err = errors.Errorf("perCPUUsage() failed!err:=%v", err) - return - } - cores = len(cpus) - } - - sets, err := cpuSets() - if err != nil { - err = errors.Errorf("cpuSets() failed!err:=%v", err) - return - } - quota := float64(len(sets)) - cq, err := cpuQuota() - if err == nil && cq != -1 { - var period uint64 - if period, err = cpuPeriod(); err != nil { - err = errors.Errorf("cpuPeriod() failed!err:=%v", err) - return - } - limit := float64(cq) / float64(period) - if limit < quota { - quota = limit - } - } - maxFreq := cpuMaxFreq() - - preSystem, err := systemCPUUsage() - if err != nil { - err = errors.Errorf("systemCPUUsage() failed!err:=%v", err) - return - } - preTotal, err := totalCPUUsage() - if err != nil { - err = errors.Errorf("totalCPUUsage() failed!err:=%v", err) - return - } - cpu = &cgroupCPU{ - frequency: maxFreq, - quota: quota, - cores: uint64(cores), - preSystem: preSystem, - preTotal: preTotal, - } - return -} - -func (cpu *cgroupCPU) Usage() (u uint64, err error) { - var ( - total uint64 - system uint64 - ) - total, err = totalCPUUsage() - if err != nil { - return - } - system, err = systemCPUUsage() - if err != nil { - return - } - if system != cpu.preSystem { - u = uint64(float64((total-cpu.preTotal)*cpu.cores*1e3) / (float64(system-cpu.preSystem) * cpu.quota)) - } - cpu.preSystem = system - cpu.preTotal = total - return -} - -func (cpu *cgroupCPU) Info() Info { - return Info{ - Frequency: cpu.frequency, - Quota: cpu.quota, - } -} - -const nanoSecondsPerSecond = 1e9 - -// ErrNoCFSLimit is no quota limit -var ErrNoCFSLimit = errors.Errorf("no quota limit") - -var clockTicksPerSecond = uint64(getClockTicks()) - -// systemCPUUsage returns the host system's cpu usage in -// nanoseconds. An error is returned if the format of the underlying -// file does not match. -// -// Uses /proc/stat defined by POSIX. Looks for the cpu -// statistics line and then sums up the first seven fields -// provided. See man 5 proc for details on specific field -// information. -func systemCPUUsage() (usage uint64, err error) { - var ( - line string - f *os.File - ) - if f, err = os.Open("/proc/stat"); err != nil { - return - } - bufReader := bufio.NewReaderSize(nil, 128) - defer func() { - bufReader.Reset(nil) - f.Close() - }() - bufReader.Reset(f) - for err == nil { - if line, err = bufReader.ReadString('\n'); err != nil { - err = errors.WithStack(err) - return - } - parts := strings.Fields(line) - switch parts[0] { - case "cpu": - if len(parts) < 8 { - err = errors.WithStack(fmt.Errorf("bad format of cpu stats")) - return - } - var totalClockTicks uint64 - for _, i := range parts[1:8] { - var v uint64 - if v, err = strconv.ParseUint(i, 10, 64); err != nil { - err = errors.WithStack(fmt.Errorf("error parsing cpu stats")) - return - } - totalClockTicks += v - } - usage = (totalClockTicks * nanoSecondsPerSecond) / clockTicksPerSecond - return - } - } - err = errors.Errorf("bad stats format") - return -} - -func totalCPUUsage() (usage uint64, err error) { - var cg *cgroup - if cg, err = currentcGroup(); err != nil { - return - } - return cg.CPUAcctUsage() -} - -func perCPUUsage() (usage []uint64, err error) { - var cg *cgroup - if cg, err = currentcGroup(); err != nil { - return - } - return cg.CPUAcctUsagePerCPU() -} - -func cpuSets() (sets []uint64, err error) { - var cg *cgroup - if cg, err = currentcGroup(); err != nil { - return - } - return cg.CPUSetCPUs() -} - -func cpuQuota() (quota int64, err error) { - var cg *cgroup - if cg, err = currentcGroup(); err != nil { - return - } - return cg.CPUCFSQuotaUs() -} - -func cpuPeriod() (peroid uint64, err error) { - var cg *cgroup - if cg, err = currentcGroup(); err != nil { - return - } - return cg.CPUCFSPeriodUs() -} - -func cpuFreq() uint64 { - lines, err := readLines("/proc/cpuinfo") - if err != nil { - return 0 - } - for _, line := range lines { - fields := strings.Split(line, ":") - if len(fields) < 2 { - continue - } - key := strings.TrimSpace(fields[0]) - value := strings.TrimSpace(fields[1]) - if key == "cpu MHz" || key == "clock" { - // treat this as the fallback value, thus we ignore error - if t, err := strconv.ParseFloat(strings.Replace(value, "MHz", "", 1), 64); err == nil { - return uint64(t * 1000.0 * 1000.0) - } - } - } - return 0 -} - -func cpuMaxFreq() uint64 { - feq := cpuFreq() - data, err := readFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq") - if err != nil { - return feq - } - // override the max freq from /proc/cpuinfo - cfeq, err := parseUint(data) - if err == nil { - feq = cfeq - } - return feq -} - -//GetClockTicks get the OS's ticks per second -func getClockTicks() int { - // TODO figure out a better alternative for platforms where we're missing cgo - // - // TODO Windows. This could be implemented using Win32 QueryPerformanceFrequency(). - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx - // - // An example of its usage can be found here. - // https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx - - return 100 -} diff --git a/cpukit/cgroup_test.go b/cpukit/cgroup_test.go deleted file mode 100644 index dc8b953..0000000 --- a/cpukit/cgroup_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build linux - -package cpukit - -import ( - "testing" -) - -func TestCGroup(t *testing.T) { - // TODO -} diff --git a/cpukit/cpu.go b/cpukit/cpu.go deleted file mode 100644 index d73be4e..0000000 --- a/cpukit/cpu.go +++ /dev/null @@ -1,68 +0,0 @@ -package cpukit - -import ( - "fmt" - "sync/atomic" - "time" -) - -const ( - interval time.Duration = time.Millisecond * 500 -) - -var ( - stats CPU - usage uint64 -) - -// CPU is cpu stat usage. -type CPU interface { - Usage() (u uint64, e error) - Info() Info -} - -func init() { - var ( - err error - ) - stats, err = newCgroupCPU() - if err != nil { - // fmt.Printf("cgroup cpu init failed(%v),switch to psutil cpu\n", err) - stats, err = newPsutilCPU(interval) - if err != nil { - panic(fmt.Sprintf("cgroup cpu init failed!err:=%v", err)) - } - } - go func() { - ticker := time.NewTicker(interval) - defer ticker.Stop() - for { - <-ticker.C - u, err := stats.Usage() - if err == nil && u != 0 { - atomic.StoreUint64(&usage, u) - } - } - }() -} - -// Stat cpu stat. -type Stat struct { - Usage uint64 // cpu use ratio. -} - -// Info cpu info. -type Info struct { - Frequency uint64 - Quota float64 -} - -// ReadStat read cpu stat. -func ReadStat(stat *Stat) { - stat.Usage = atomic.LoadUint64(&usage) -} - -// GetInfo get cpu info. -func GetInfo() Info { - return stats.Info() -} diff --git a/cpukit/cpu_test.go b/cpukit/cpu_test.go deleted file mode 100644 index cbce658..0000000 --- a/cpukit/cpu_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package cpukit - -import ( - "fmt" - "testing" - "time" -) - -func Test_CPUUsage(t *testing.T) { - var stat Stat - ReadStat(&stat) - fmt.Println(stat) - time.Sleep(time.Millisecond * 1000) - for i := 0; i < 1000; i++ { - time.Sleep(time.Millisecond * 500) - ReadStat(&stat) - if stat.Usage == 0 { - t.Fatalf("get cpu failed!cpu usage is zero!") - } - fmt.Println(stat) - } -} diff --git a/cpukit/psutilCPU.go b/cpukit/psutilCPU.go deleted file mode 100644 index f559a7a..0000000 --- a/cpukit/psutilCPU.go +++ /dev/null @@ -1,45 +0,0 @@ -package cpukit - -import ( - "time" - - "github.com/shirou/gopsutil/cpu" -) - -type psutilCPU struct { - interval time.Duration -} - -func newPsutilCPU(interval time.Duration) (cpu *psutilCPU, err error) { - cpu = &psutilCPU{interval: interval} - _, err = cpu.Usage() - if err != nil { - return - } - return -} - -func (ps *psutilCPU) Usage() (u uint64, err error) { - var percents []float64 - percents, err = cpu.Percent(ps.interval, false) - if err == nil { - u = uint64(percents[0] * 10) - } - return -} - -func (ps *psutilCPU) Info() (info Info) { - stats, err := cpu.Info() - if err != nil { - return - } - cores, err := cpu.Counts(true) - if err != nil { - return - } - info = Info{ - Frequency: uint64(stats[0].Mhz), - Quota: float64(cores), - } - return -} diff --git a/cpukit/stat_test.go b/cpukit/stat_test.go deleted file mode 100644 index ddd0bab..0000000 --- a/cpukit/stat_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package cpukit - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestStat(t *testing.T) { - time.Sleep(time.Second * 2) - var s Stat - var i Info - ReadStat(&s) - i = GetInfo() - - assert.NotZero(t, s.Usage) - assert.NotZero(t, i.Frequency) - assert.NotZero(t, i.Quota) -} diff --git a/cpukit/util.go b/cpukit/util.go deleted file mode 100644 index 28d35e2..0000000 --- a/cpukit/util.go +++ /dev/null @@ -1,121 +0,0 @@ -package cpukit - -import ( - "bufio" - "io/ioutil" - "os" - "strconv" - "strings" - - "github.com/pkg/errors" -) - -func readFile(path string) (string, error) { - contents, err := ioutil.ReadFile(path) - if err != nil { - return "", errors.Wrapf(err, "os/stat: read file(%s) failed!", path) - } - return strings.TrimSpace(string(contents)), nil -} - -func parseUint(s string) (uint64, error) { - v, err := strconv.ParseUint(s, 10, 64) - if err != nil { - intValue, intErr := strconv.ParseInt(s, 10, 64) - // 1. Handle negative values greater than MinInt64 (and) - // 2. Handle negative values lesser than MinInt64 - if intErr == nil && intValue < 0 { - return 0, nil - } else if intErr != nil && - intErr.(*strconv.NumError).Err == strconv.ErrRange && - intValue < 0 { - return 0, nil - } - return 0, errors.Wrapf(err, "os/stat: parseUint(%s) failed!", s) - } - return v, nil -} - -// ParseUintList parses and validates the specified string as the value -// found in some cgroup file (e.g. cpuset.cpus, cpuset.mems), which could be -// one of the formats below. Note that duplicates are actually allowed in the -// input string. It returns a map[int]bool with available elements from val -// set to true. -// Supported formats: -// 7 -// 1-6 -// 0,3-4,7,8-10 -// 0-0,0,1-7 -// 03,1-3 <- this is gonna get parsed as [1,2,3] -// 3,2,1 -// 0-2,3,1 -func ParseUintList(val string) (map[int]bool, error) { - if val == "" { - return map[int]bool{}, nil - } - - availableInts := make(map[int]bool) - split := strings.Split(val, ",") - errInvalidFormat := errors.Errorf("os/stat: invalid format: %s", val) - for _, r := range split { - if !strings.Contains(r, "-") { - v, err := strconv.Atoi(r) - if err != nil { - return nil, errInvalidFormat - } - availableInts[v] = true - } else { - split := strings.SplitN(r, "-", 2) - min, err := strconv.Atoi(split[0]) - if err != nil { - return nil, errInvalidFormat - } - max, err := strconv.Atoi(split[1]) - if err != nil { - return nil, errInvalidFormat - } - if max < min { - return nil, errInvalidFormat - } - for i := min; i <= max; i++ { - availableInts[i] = true - } - } - } - return availableInts, nil -} - -// ReadLines reads contents from a file and splits them by new lines. -// A convenience wrapper to ReadLinesOffsetN(filename, 0, -1). -func readLines(filename string) ([]string, error) { - return readLinesOffsetN(filename, 0, -1) -} - -// ReadLinesOffsetN reads contents from file and splits them by new line. -// The offset tells at which line number to start. -// The count determines the number of lines to read (starting from offset): -// n >= 0: at most n lines -// n < 0: whole file -func readLinesOffsetN(filename string, offset uint, n int) ([]string, error) { - f, err := os.Open(filename) - if err != nil { - return []string{""}, err - } - defer f.Close() - - var ret []string - - r := bufio.NewReader(f) - for i := 0; i < n+int(offset) || n < 0; i++ { - line, err := r.ReadString('\n') - if err != nil { - break - } - if i < int(offset) { - continue - } - ret = append(ret, strings.Trim(line, "\n")) - } - - return ret, nil -} diff --git a/go.mod b/go.mod index 1bad4d6..0c29e9e 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,14 @@ go 1.14 require ( github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect github.com/gin-gonic/gin v1.6.3 + github.com/go-kratos/kratos v1.0.0 github.com/go-ole/go-ole v1.2.5 // indirect github.com/go-playground/assert/v2 v2.0.1 github.com/go-redis/redis/v7 v7.2.0 github.com/onsi/ginkgo v1.10.2 // indirect - github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.10.0 - github.com/shirou/gopsutil v3.21.4+incompatible + github.com/prometheus/client_golang v1.10.0 // indirect + github.com/shirou/gopsutil v3.21.4+incompatible // indirect github.com/speps/go-hashids v2.0.0+incompatible - github.com/stretchr/testify v1.4.0 github.com/tklauser/go-sysconf v0.3.5 // indirect golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect ) diff --git a/go.sum b/go.sum index 8f312b2..048a254 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,13 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/HdrHistogram/hdrhistogram-go v1.0.1/go.mod h1:BWJ+nMSHY3L41Zj7CA3uXnloDp7xxV0YvstAE7nKTaM= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/sarama v1.23.1/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 h1:5sXbqlSomvdjlRbWyNqkPsJ3Fg+tQZCbgeX1VGljbQY= github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= @@ -13,9 +17,15 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy 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/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/aristanetworks/fsnotify v1.4.2/go.mod h1:D/rtu7LpjYM8tRJphJ0hUBYpjai8SfX+aSNsWDTq/Ks= +github.com/aristanetworks/glog v0.0.0-20180419172825-c15b03b3054f/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA= +github.com/aristanetworks/goarista v0.0.0-20190912214011-b54698eaaca6/go.mod h1:Z4RTxGAuYhPzcq8+EdRM+R8M48Ssle2TsWtwRKa+vns= +github.com/aristanetworks/splunk-hec-go v0.3.3/go.mod h1:1VHO9r17b0K7WmOlLb9nTk/2YanvOEnLMUgsFrxBROc= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= @@ -34,30 +44,47 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= +github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -66,15 +93,20 @@ github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwv 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-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kratos/kratos v1.0.0 h1:BEtuBTfdFqi8kIZlyx1Vxi97wB2i91b4mTw8ELQQ7rA= +github.com/go-kratos/kratos v1.0.0/go.mod h1:A7PPDfrv/g9H3ATDg9xVJACirFxi0GDxpjey5e169V0= 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-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= @@ -82,19 +114,31 @@ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GO github.com/go-redis/redis/v7 v7.2.0 h1:CrCexy/jYWZjW0AyVoHlcJUeZN19VWlbepTh1Vq6dJs= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-zookeeper/zk v1.0.1/go.mod h1:gpJdHazfkmlg4V0rt0vYeHYJHSL8hHFwV0qOd+HRTJE= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 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.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= 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= @@ -104,25 +148,31 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 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/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -139,6 +189,7 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= @@ -147,8 +198,11 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -161,21 +215,29 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/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 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 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/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= @@ -186,6 +248,7 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= @@ -197,6 +260,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= @@ -206,6 +270,8 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -218,6 +284,8 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+LKzfOAhKTT5O0ehDix+MTqbtT0T9t+7zzOvc= +github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2A+zigScwkSEb/cVQB0/ZMpU3rqiH6X7WRRsxgOGw= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -226,10 +294,14 @@ github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxS github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/otokaze/mock v0.0.0-20190125081256-8282b7a7c7c3/go.mod h1:pLR8n2aimFxvvDJ6n8JuQWthMGezCYMjuhlaTjPTZf0= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/philchia/agollo/v4 v4.1.1/go.mod h1:SBdQmfqqu/XCWJ1MDzYcCL3X+p3VJ+uQBy0nxxqjexg= +github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -243,7 +315,9 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.10.0 h1:/o0BDeWzLWXNZ+4q5gXltUvaMpJqckTa+jTNoB+z4cg= github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= @@ -256,29 +330,46 @@ github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2 github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.18.0 h1:WCVKW7aL6LEe1uryfI9dnEc2ZqNB1Fn0ok930v0iL1Y= github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.5.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shirou/gopsutil v2.19.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v3.21.4+incompatible h1:fuHcTm5mX+wzo542cmYcV9RTGQLbnHLI5SyQ5ryTVck= github.com/shirou/gopsutil v3.21.4+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= @@ -286,8 +377,15 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/speps/go-hashids v2.0.0+incompatible h1:kSfxGfESueJKTx0mpER9Y/1XHl+FVQjtCqRyYcviFbw= github.com/speps/go-hashids v2.0.0+incompatible/go.mod h1:P7hqPzMdnZOfyIk+xrlG1QaSMw+gCBdHKsBDnhpaZvc= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -295,38 +393,65 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= +github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= +github.com/tjfoc/gmsm v1.0.1/go.mod h1:XxO4hdhhrzAd+G4CjDqaOkd0hUzmtPR/d3EiBBMn/wc= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tsuna/gohbase v0.0.0-20190502052937-24ffed0537aa/go.mod h1:3HfLQly3YNLGxNv/2YOfmz30vcjG9hbuME1GpxoLlGs= +github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= +github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= +github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/xtaci/kcp-go v5.4.5+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE= +github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -352,7 +477,10 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR 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-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -373,20 +501,30 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/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-20200122134326-e047566fdf82/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-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-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa h1:ZYxPR6aca/uhfRJyaOAtflSHjJYiktO7QnJC5ut7iY4= @@ -395,33 +533,44 @@ 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-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 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-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190912185636-87d9f09c5d89/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191105231337-689d0f08e67a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20200402124713-8ff61da6d932/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -430,7 +579,11 @@ google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -439,15 +592,25 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi 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/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= 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/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo= +gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q= +gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4= +gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM= +gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= +gopkg.in/redis.v4 v4.2.4/go.mod h1:8KREHdypkCEojGKQcjMqAODMICIVwZAONWq8RowTITA= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -455,14 +618,19 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= 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.3/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.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +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-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/group/README.md b/group/README.md deleted file mode 100644 index 33d48ba..0000000 --- a/group/README.md +++ /dev/null @@ -1,12 +0,0 @@ -#### group - -##### 项目简介 - -懒加载对象容器 - -##### 编译环境 - -- **推荐 Golang v1.12.1 以上版本编译执行** - -##### 依赖包 - diff --git a/group/example_test.go b/group/example_test.go deleted file mode 100644 index 9f52fb8..0000000 --- a/group/example_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package group - -import "fmt" - -type Counter struct { - Value int -} - -func (c *Counter) Incr() { - c.Value++ -} - -func ExampleGroup_Get() { - new := func() interface{} { - fmt.Println("Only Once") - return &Counter{} - } - group := NewGroup(new) - - // Create a new Counter - group.Get("pass").(*Counter).Incr() - - // Get the created Counter again. - group.Get("pass").(*Counter).Incr() - // Output: - // Only Once -} - -func ExampleGroup_Reset() { - new := func() interface{} { - return &Counter{} - } - group := NewGroup(new) - - newV2 := func() interface{} { - fmt.Println("New V2") - return &Counter{} - } - // Reset the new function and clear all created objects. - group.Reset(newV2) - - // Create a new Counter - group.Get("pass").(*Counter).Incr() - // Output: - // New V2 -} diff --git a/group/group.go b/group/group.go deleted file mode 100644 index ad0324d..0000000 --- a/group/group.go +++ /dev/null @@ -1,64 +0,0 @@ -// Package group provides a sample lazy load container. -// The group only creating a new object not until the object is needed by user. -// And it will cache all the objects to reduce the creation of object. -package group - -import "sync" - -// Group is a lazy load container. -type Group struct { - new func() interface{} - objs map[string]interface{} - sync.RWMutex -} - -// NewGroup news a group container. -func NewGroup(new func() interface{}) *Group { - if new == nil { - panic("container.group: can't assign a nil to the new function") - } - return &Group{ - new: new, - objs: make(map[string]interface{}), - } -} - -// Get gets the object by the given key. -func (g *Group) Get(key string) interface{} { - g.RLock() - obj, ok := g.objs[key] - if ok { - g.RUnlock() - return obj - } - g.RUnlock() - - // double check - g.Lock() - defer g.Unlock() - obj, ok = g.objs[key] - if ok { - return obj - } - obj = g.new() - g.objs[key] = obj - return obj -} - -// Reset resets the new function and deletes all existing objects. -func (g *Group) Reset(new func() interface{}) { - if new == nil { - panic("container.group: can't assign a nil to the new function") - } - g.Lock() - g.new = new - g.Unlock() - g.Clear() -} - -// Clear deletes all objects. -func (g *Group) Clear() { - g.Lock() - g.objs = make(map[string]interface{}) - g.Unlock() -} diff --git a/group/group_test.go b/group/group_test.go deleted file mode 100644 index 50464db..0000000 --- a/group/group_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package group - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGroupGet(t *testing.T) { - count := 0 - g := NewGroup(func() interface{} { - count++ - return count - }) - v := g.Get("/x/internal/dummy/user") - assert.Equal(t, 1, v.(int)) - - v = g.Get("/x/internal/dummy/avatar") - assert.Equal(t, 2, v.(int)) - - v = g.Get("/x/internal/dummy/user") - assert.Equal(t, 1, v.(int)) - assert.Equal(t, 2, count) -} - -func TestGroupReset(t *testing.T) { - g := NewGroup(func() interface{} { - return 1 - }) - g.Get("/x/internal/dummy/user") - call := false - g.Reset(func() interface{} { - call = true - return 1 - }) - - length := 0 - for range g.objs { - length++ - } - - assert.Equal(t, 0, length) - - g.Get("/x/internal/dummy/user") - assert.Equal(t, true, call) -} - -func TestGroupClear(t *testing.T) { - g := NewGroup(func() interface{} { - return 1 - }) - g.Get("/x/internal/dummy/user") - length := 0 - for range g.objs { - length++ - } - assert.Equal(t, 1, length) - - g.Clear() - length = 0 - for range g.objs { - length++ - } - assert.Equal(t, 0, length) -} diff --git a/metric/counter.go b/metric/counter.go deleted file mode 100644 index 6015899..0000000 --- a/metric/counter.go +++ /dev/null @@ -1,84 +0,0 @@ -package metric - -import ( - "fmt" - "sync/atomic" - - "github.com/prometheus/client_golang/prometheus" -) - -var _ Metric = &counter{} - -// Counter stores a numerical value that only ever goes up. -type Counter interface { - Metric -} - -// CounterOpts is an alias of Opts. -type CounterOpts Opts - -type counter struct { - val int64 -} - -// NewCounter creates a new Counter based on the CounterOpts. -func NewCounter(opts CounterOpts) Counter { - return &counter{} -} - -func (c *counter) Add(val int64) { - if val < 0 { - panic(fmt.Errorf("stat/metric: cannot decrease in negative value. val: %d", val)) - } - atomic.AddInt64(&c.val, val) -} - -func (c *counter) Value() int64 { - return atomic.LoadInt64(&c.val) -} - -// CounterVecOpts is an alias of VectorOpts. -type CounterVecOpts VectorOpts - -// CounterVec counter vec. -type CounterVec interface { - // Inc increments the counter by 1. Use Add to increment it by arbitrary - // non-negative values. - Inc(labels ...string) - // Add adds the given value to the counter. It panics if the value is < - // 0. - Add(v float64, labels ...string) -} - -// counterVec counter vec. -type promCounterVec struct { - counter *prometheus.CounterVec -} - -// NewCounterVec . -func NewCounterVec(cfg *CounterVecOpts) CounterVec { - if cfg == nil { - return nil - } - vec := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Namespace: cfg.Namespace, - Subsystem: cfg.Subsystem, - Name: cfg.Name, - Help: cfg.Help, - }, cfg.Labels) - prometheus.MustRegister(vec) - return &promCounterVec{ - counter: vec, - } -} - -// Inc Inc increments the counter by 1. Use Add to increment it by arbitrary. -func (counter *promCounterVec) Inc(labels ...string) { - counter.counter.WithLabelValues(labels...).Inc() -} - -// Add Inc increments the counter by 1. Use Add to increment it by arbitrary. -func (counter *promCounterVec) Add(v float64, labels ...string) { - counter.counter.WithLabelValues(labels...).Add(v) -} diff --git a/metric/counter_test.go b/metric/counter_test.go deleted file mode 100644 index 413a61c..0000000 --- a/metric/counter_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package metric - -import ( - "math/rand" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestCounter(t *testing.T) { - counter := NewCounter(CounterOpts{}) - count := rand.Intn(100) - for i := 0; i < count; i++ { - counter.Add(1) - } - val := counter.Value() - assert.Equal(t, val, int64(count)) -} - -func TestCounterVec(t *testing.T) { - counterVec := NewCounterVec(&CounterVecOpts{ - Namespace: "test", - Subsystem: "test", - Name: "test", - Help: "this is test metrics.", - Labels: []string{"name", "addr"}, - }) - counterVec.Inc("name1", "127.0.0.1") - assert.Panics(t, func() { - NewCounterVec(&CounterVecOpts{ - Namespace: "test", - Subsystem: "test", - Name: "test", - Help: "this is test metrics.", - Labels: []string{"name", "addr"}, - }) - }, "Expected to panic.") - assert.NotPanics(t, func() { - NewCounterVec(&CounterVecOpts{ - Namespace: "test", - Subsystem: "test", - Name: "test2", - Help: "this is test metrics.", - Labels: []string{"name", "addr"}, - }) - }, "Expected normal. no panic.") -} diff --git a/metric/gauge.go b/metric/gauge.go deleted file mode 100644 index de6980a..0000000 --- a/metric/gauge.go +++ /dev/null @@ -1,94 +0,0 @@ -package metric - -import ( - "sync/atomic" - - "github.com/prometheus/client_golang/prometheus" -) - -var _ Metric = &gauge{} - -// Gauge stores a numerical value that can be add arbitrarily. -type Gauge interface { - Metric - // Sets sets the value to the given number. - Set(int64) -} - -// GaugeOpts is an alias of Opts. -type GaugeOpts Opts - -type gauge struct { - val int64 -} - -// NewGauge creates a new Gauge based on the GaugeOpts. -func NewGauge(opts GaugeOpts) Gauge { - return &gauge{} -} - -func (g *gauge) Add(val int64) { - atomic.AddInt64(&g.val, val) -} - -func (g *gauge) Set(val int64) { - old := atomic.LoadInt64(&g.val) - atomic.CompareAndSwapInt64(&g.val, old, val) -} - -func (g *gauge) Value() int64 { - return atomic.LoadInt64(&g.val) -} - -// GaugeVecOpts is an alias of VectorOpts. -type GaugeVecOpts VectorOpts - -// GaugeVec gauge vec. -type GaugeVec interface { - // Set sets the Gauge to an arbitrary value. - Set(v float64, labels ...string) - // Inc increments the Gauge by 1. Use Add to increment it by arbitrary - // values. - Inc(labels ...string) - // Add adds the given value to the Gauge. (The value can be negative, - // resulting in a decrease of the Gauge.) - Add(v float64, labels ...string) -} - -// gaugeVec gauge vec. -type promGaugeVec struct { - gauge *prometheus.GaugeVec -} - -// NewGaugeVec . -func NewGaugeVec(cfg *GaugeVecOpts) GaugeVec { - if cfg == nil { - return nil - } - vec := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: cfg.Namespace, - Subsystem: cfg.Subsystem, - Name: cfg.Name, - Help: cfg.Help, - }, cfg.Labels) - prometheus.MustRegister(vec) - return &promGaugeVec{ - gauge: vec, - } -} - -// Inc Inc increments the counter by 1. Use Add to increment it by arbitrary. -func (gauge *promGaugeVec) Inc(labels ...string) { - gauge.gauge.WithLabelValues(labels...).Inc() -} - -// Add Inc increments the counter by 1. Use Add to increment it by arbitrary. -func (gauge *promGaugeVec) Add(v float64, labels ...string) { - gauge.gauge.WithLabelValues(labels...).Add(v) -} - -// Set set the given value to the collection. -func (gauge *promGaugeVec) Set(v float64, labels ...string) { - gauge.gauge.WithLabelValues(labels...).Set(v) -} diff --git a/metric/gauge_test.go b/metric/gauge_test.go deleted file mode 100644 index b3cb26d..0000000 --- a/metric/gauge_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package metric - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGaugeAdd(t *testing.T) { - gauge := NewGauge(GaugeOpts{}) - gauge.Add(100) - gauge.Add(-50) - val := gauge.Value() - assert.Equal(t, val, int64(50)) -} - -func TestGaugeSet(t *testing.T) { - gauge := NewGauge(GaugeOpts{}) - gauge.Add(100) - gauge.Set(50) - val := gauge.Value() - assert.Equal(t, val, int64(50)) -} diff --git a/metric/histogram.go b/metric/histogram.go deleted file mode 100644 index 8a7af58..0000000 --- a/metric/histogram.go +++ /dev/null @@ -1,50 +0,0 @@ -package metric - -import ( - "github.com/prometheus/client_golang/prometheus" -) - -// HistogramVecOpts is histogram vector opts. -type HistogramVecOpts struct { - Namespace string - Subsystem string - Name string - Help string - Labels []string - Buckets []float64 -} - -// HistogramVec gauge vec. -type HistogramVec interface { - // Observe adds a single observation to the histogram. - Observe(v int64, labels ...string) -} - -// Histogram prom histogram collection. -type promHistogramVec struct { - histogram *prometheus.HistogramVec -} - -// NewHistogramVec new a histogram vec. -func NewHistogramVec(cfg *HistogramVecOpts) HistogramVec { - if cfg == nil { - return nil - } - vec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Namespace: cfg.Namespace, - Subsystem: cfg.Subsystem, - Name: cfg.Name, - Help: cfg.Help, - Buckets: cfg.Buckets, - }, cfg.Labels) - prometheus.MustRegister(vec) - return &promHistogramVec{ - histogram: vec, - } -} - -// Timing adds a single observation to the histogram. -func (histogram *promHistogramVec) Observe(v int64, labels ...string) { - histogram.histogram.WithLabelValues(labels...).Observe(float64(v)) -} diff --git a/metric/iterator.go b/metric/iterator.go deleted file mode 100644 index b0cac69..0000000 --- a/metric/iterator.go +++ /dev/null @@ -1,26 +0,0 @@ -package metric - -import "fmt" - -// Iterator iterates the buckets within the window. -type Iterator struct { - count int - iteratedCount int - cur *Bucket -} - -// Next returns true util all of the buckets has been iterated. -func (i *Iterator) Next() bool { - return i.count != i.iteratedCount -} - -// Bucket gets current bucket. -func (i *Iterator) Bucket() Bucket { - if !(i.Next()) { - panic(fmt.Errorf("stat/metric: iteration out of range iteratedCount: %d count: %d", i.iteratedCount, i.count)) - } - bucket := *i.cur - i.iteratedCount++ - i.cur = i.cur.Next() - return bucket -} diff --git a/metric/metric.go b/metric/metric.go deleted file mode 100644 index 9ea08ca..0000000 --- a/metric/metric.go +++ /dev/null @@ -1,104 +0,0 @@ -package metric - -import ( - "errors" - "fmt" -) - -// Opts contains the common arguments for creating Metric. -type Opts struct { -} - -// Metric is a sample interface. -// Implementations of Metrics in metric package are Counter, Gauge, -// PointGauge, RollingCounter and RollingGauge. -type Metric interface { - // Add adds the given value to the counter. - Add(int64) - // Value gets the current value. - // If the metric's type is PointGauge, RollingCounter, RollingGauge, - // it returns the sum value within the window. - Value() int64 -} - -// Aggregation contains some common aggregation function. -// Each aggregation can compute summary statistics of window. -type Aggregation interface { - // Min finds the min value within the window. - Min() float64 - // Max finds the max value within the window. - Max() float64 - // Avg computes average value within the window. - Avg() float64 - // Sum computes sum value within the window. - Sum() float64 -} - -// VectorOpts contains the common arguments for creating vec Metric.. -type VectorOpts struct { - Namespace string - Subsystem string - Name string - Help string - Labels []string -} - -const ( - _businessNamespace = "business" - _businessSubsystemCount = "count" - _businessSubSystemGauge = "gauge" - _businessSubSystemHistogram = "histogram" -) - -var ( - _defaultBuckets = []float64{5, 10, 25, 50, 100, 250, 500} -) - -// NewBusinessMetricCount business Metric count vec. -// name or labels should not be empty. -func NewBusinessMetricCount(name string, labels ...string) CounterVec { - if name == "" || len(labels) == 0 { - panic(errors.New("stat:metric business count metric name should not be empty or labels length should be greater than zero")) - } - return NewCounterVec(&CounterVecOpts{ - Namespace: _businessNamespace, - Subsystem: _businessSubsystemCount, - Name: name, - Labels: labels, - Help: fmt.Sprintf("business metric count %s", name), - }) -} - -// NewBusinessMetricGauge business Metric gauge vec. -// name or labels should not be empty. -func NewBusinessMetricGauge(name string, labels ...string) GaugeVec { - if name == "" || len(labels) == 0 { - panic(errors.New("stat:metric business gauge metric name should not be empty or labels length should be greater than zero")) - } - return NewGaugeVec(&GaugeVecOpts{ - Namespace: _businessNamespace, - Subsystem: _businessSubSystemGauge, - Name: name, - Labels: labels, - Help: fmt.Sprintf("business metric gauge %s", name), - }) -} - -// NewBusinessMetricHistogram business Metric histogram vec. -// name or labels should not be empty. -func NewBusinessMetricHistogram(name string, buckets []float64, labels ...string) HistogramVec { - if name == "" || len(labels) == 0 { - panic(errors.New("stat:metric business histogram metric name should not be empty or labels length should be greater than zero")) - } - if len(buckets) == 0 { - buckets = _defaultBuckets - } - return NewHistogramVec(&HistogramVecOpts{ - Namespace: _businessNamespace, - Subsystem: _businessSubSystemHistogram, - Name: name, - Labels: labels, - Buckets: buckets, - Help: fmt.Sprintf("business metric histogram %s", name), - }) -} diff --git a/metric/point_gauge.go b/metric/point_gauge.go deleted file mode 100644 index 0fc15a6..0000000 --- a/metric/point_gauge.go +++ /dev/null @@ -1,61 +0,0 @@ -package metric - -var _ Metric = &pointGauge{} -var _ Aggregation = &pointGauge{} - -// PointGauge represents a ring window. -// Every buckets within the window contains one point. -// When the window is full, the earliest point will be overwrite. -type PointGauge interface { - Aggregation - Metric - // Reduce applies the reduction function to all buckets within the window. - Reduce(func(Iterator) float64) float64 -} - -// PointGaugeOpts contains the arguments for creating PointGauge. -type PointGaugeOpts struct { - // Size represents the bucket size within the window. - Size int -} - -type pointGauge struct { - policy *PointPolicy -} - -// NewPointGauge creates a new PointGauge based on PointGaugeOpts. -func NewPointGauge(opts PointGaugeOpts) PointGauge { - window := NewWindow(WindowOpts{Size: opts.Size}) - policy := NewPointPolicy(window) - return &pointGauge{ - policy: policy, - } -} - -func (r *pointGauge) Add(val int64) { - r.policy.Append(float64(val)) -} - -func (r *pointGauge) Reduce(f func(Iterator) float64) float64 { - return r.policy.Reduce(f) -} - -func (r *pointGauge) Avg() float64 { - return r.policy.Reduce(Avg) -} - -func (r *pointGauge) Min() float64 { - return r.policy.Reduce(Min) -} - -func (r *pointGauge) Max() float64 { - return r.policy.Reduce(Max) -} - -func (r *pointGauge) Sum() float64 { - return r.policy.Reduce(Sum) -} - -func (r *pointGauge) Value() int64 { - return int64(r.Sum()) -} diff --git a/metric/point_gauge_test.go b/metric/point_gauge_test.go deleted file mode 100644 index fcfee47..0000000 --- a/metric/point_gauge_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package metric - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestPointGaugeAdd(t *testing.T) { - opts := PointGaugeOpts{Size: 3} - pointGauge := NewPointGauge(opts) - listBuckets := func() [][]float64 { - buckets := make([][]float64, 0) - pointGauge.Reduce(func(i Iterator) float64 { - for i.Next() { - bucket := i.Bucket() - buckets = append(buckets, bucket.Points) - } - return 0.0 - }) - return buckets - } - assert.Equal(t, [][]float64{{}, {}, {}}, listBuckets(), "Empty Buckets") - pointGauge.Add(1) - assert.Equal(t, [][]float64{{}, {}, {1}}, listBuckets(), "Point 1") - pointGauge.Add(2) - assert.Equal(t, [][]float64{{}, {1}, {2}}, listBuckets(), "Point 1, 2") - pointGauge.Add(3) - assert.Equal(t, [][]float64{{1}, {2}, {3}}, listBuckets(), "Point 1, 2, 3") - pointGauge.Add(4) - assert.Equal(t, [][]float64{{2}, {3}, {4}}, listBuckets(), "Point 2, 3, 4") - pointGauge.Add(5) - assert.Equal(t, [][]float64{{3}, {4}, {5}}, listBuckets(), "Point 3, 4, 5") -} - -func TestPointGaugeReduce(t *testing.T) { - opts := PointGaugeOpts{Size: 10} - pointGauge := NewPointGauge(opts) - for i := 0; i < opts.Size; i++ { - pointGauge.Add(int64(i)) - } - var _ = pointGauge.Reduce(func(i Iterator) float64 { - idx := 0 - for i.Next() { - bucket := i.Bucket() - assert.Equal(t, bucket.Points[0], float64(idx), "validate points of pointGauge") - idx++ - } - return 0.0 - }) - assert.Equal(t, float64(9), pointGauge.Max(), "validate max of pointGauge") - assert.Equal(t, float64(4.5), pointGauge.Avg(), "validate avg of pointGauge") - assert.Equal(t, float64(0), pointGauge.Min(), "validate min of pointGauge") - assert.Equal(t, float64(45), pointGauge.Sum(), "validate sum of pointGauge") -} diff --git a/metric/point_policy.go b/metric/point_policy.go deleted file mode 100644 index aae8934..0000000 --- a/metric/point_policy.go +++ /dev/null @@ -1,57 +0,0 @@ -package metric - -import "sync" - -// PointPolicy is a policy of points within the window. -// PointPolicy wraps the window and make it seem like ring-buf. -// When using PointPolicy, every buckets within the windows contains at more one point. -// e.g. [[1], [2], [3]] -type PointPolicy struct { - mu sync.RWMutex - size int - window *Window - offset int -} - -// NewPointPolicy creates a new PointPolicy. -func NewPointPolicy(window *Window) *PointPolicy { - return &PointPolicy{ - window: window, - size: window.Size(), - offset: -1, - } -} - -func (p *PointPolicy) prevOffset() int { - return p.offset -} - -func (p *PointPolicy) nextOffset() int { - return (p.prevOffset() + 1) % p.size -} - -func (p *PointPolicy) updateOffset(offset int) { - p.offset = offset -} - -// Append appends the given points to the window. -func (p *PointPolicy) Append(val float64) { - p.mu.Lock() - defer p.mu.Unlock() - offset := p.nextOffset() - p.window.ResetBucket(offset) - p.window.Append(offset, val) - p.updateOffset(offset) -} - -// Reduce applies the reduction function to all buckets within the window. -func (p *PointPolicy) Reduce(f func(Iterator) float64) float64 { - p.mu.RLock() - defer p.mu.RUnlock() - offset := p.offset + 1 - if offset == p.size { - offset = 0 - } - iterator := p.window.Iterator(offset, p.size) - return f(iterator) -} diff --git a/metric/reduce.go b/metric/reduce.go deleted file mode 100644 index 20165c9..0000000 --- a/metric/reduce.go +++ /dev/null @@ -1,77 +0,0 @@ -package metric - -// Sum the values within the window. -func Sum(iterator Iterator) float64 { - var result = 0.0 - for iterator.Next() { - bucket := iterator.Bucket() - for _, p := range bucket.Points { - result = result + p - } - } - return result -} - -// Avg the values within the window. -func Avg(iterator Iterator) float64 { - var result = 0.0 - var count = 0.0 - for iterator.Next() { - bucket := iterator.Bucket() - for _, p := range bucket.Points { - result = result + p - count = count + 1 - } - } - return result / count -} - -// Min the values within the window. -func Min(iterator Iterator) float64 { - var result = 0.0 - var started = false - for iterator.Next() { - bucket := iterator.Bucket() - for _, p := range bucket.Points { - if !started { - result = p - started = true - continue - } - if p < result { - result = p - } - } - } - return result -} - -// Max the values within the window. -func Max(iterator Iterator) float64 { - var result = 0.0 - var started = false - for iterator.Next() { - bucket := iterator.Bucket() - for _, p := range bucket.Points { - if !started { - result = p - started = true - continue - } - if p > result { - result = p - } - } - } - return result -} - -// Count sums the count value within the window. -func Count(iterator Iterator) float64 { - var result int64 - for iterator.Next() { - bucket := iterator.Bucket() - result += bucket.Count - } - return float64(result) -} diff --git a/metric/reduce_test.go b/metric/reduce_test.go deleted file mode 100644 index 5165dd2..0000000 --- a/metric/reduce_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package metric - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestCount(t *testing.T) { - opts := PointGaugeOpts{Size: 10} - pointGauge := NewPointGauge(opts) - for i := 0; i < opts.Size; i++ { - pointGauge.Add(int64(i)) - } - result := pointGauge.Reduce(Count) - assert.Equal(t, float64(10), result, "validate count of pointGauge") -} diff --git a/metric/rolling_counter.go b/metric/rolling_counter.go deleted file mode 100644 index e103843..0000000 --- a/metric/rolling_counter.go +++ /dev/null @@ -1,75 +0,0 @@ -package metric - -import ( - "fmt" - "time" -) - -var _ Metric = &rollingCounter{} -var _ Aggregation = &rollingCounter{} - -// RollingCounter represents a ring window based on time duration. -// e.g. [[1], [3], [5]] -type RollingCounter interface { - Metric - Aggregation - Timespan() int - // Reduce applies the reduction function to all buckets within the window. - Reduce(func(Iterator) float64) float64 -} - -// RollingCounterOpts contains the arguments for creating RollingCounter. -type RollingCounterOpts struct { - Size int - BucketDuration time.Duration -} - -type rollingCounter struct { - policy *RollingPolicy -} - -// NewRollingCounter creates a new RollingCounter bases on RollingCounterOpts. -func NewRollingCounter(opts RollingCounterOpts) RollingCounter { - window := NewWindow(WindowOpts{Size: opts.Size}) - policy := NewRollingPolicy(window, RollingPolicyOpts{BucketDuration: opts.BucketDuration}) - return &rollingCounter{ - policy: policy, - } -} - -func (r *rollingCounter) Add(val int64) { - if val < 0 { - panic(fmt.Errorf("stat/metric: cannot decrease in value. val: %d", val)) - } - r.policy.Add(float64(val)) -} - -func (r *rollingCounter) Reduce(f func(Iterator) float64) float64 { - return r.policy.Reduce(f) -} - -func (r *rollingCounter) Avg() float64 { - return r.policy.Reduce(Avg) -} - -func (r *rollingCounter) Min() float64 { - return r.policy.Reduce(Min) -} - -func (r *rollingCounter) Max() float64 { - return r.policy.Reduce(Max) -} - -func (r *rollingCounter) Sum() float64 { - return r.policy.Reduce(Sum) -} - -func (r *rollingCounter) Value() int64 { - return int64(r.Sum()) -} - -func (r *rollingCounter) Timespan() int { - r.policy.mu.RLock() - defer r.policy.mu.RUnlock() - return r.policy.timespan() -} diff --git a/metric/rolling_counter_test.go b/metric/rolling_counter_test.go deleted file mode 100644 index 82caa52..0000000 --- a/metric/rolling_counter_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package metric - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestRollingCounterAdd(t *testing.T) { - size := 3 - bucketDuration := time.Second - opts := RollingCounterOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingCounter(opts) - listBuckets := func() [][]float64 { - buckets := make([][]float64, 0) - r.Reduce(func(i Iterator) float64 { - for i.Next() { - bucket := i.Bucket() - buckets = append(buckets, bucket.Points) - } - return 0.0 - }) - return buckets - } - assert.Equal(t, [][]float64{{}, {}, {}}, listBuckets()) - r.Add(1) - assert.Equal(t, [][]float64{{}, {}, {1}}, listBuckets()) - time.Sleep(time.Second) - r.Add(2) - r.Add(3) - assert.Equal(t, [][]float64{{}, {1}, {5}}, listBuckets()) - time.Sleep(time.Second) - r.Add(4) - r.Add(5) - r.Add(6) - assert.Equal(t, [][]float64{{1}, {5}, {15}}, listBuckets()) - time.Sleep(time.Second) - r.Add(7) - assert.Equal(t, [][]float64{{5}, {15}, {7}}, listBuckets()) -} - -func TestRollingCounterReduce(t *testing.T) { - size := 3 - bucketDuration := time.Second - opts := RollingCounterOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingCounter(opts) - for x := 0; x < size; x = x + 1 { - for i := 0; i <= x; i++ { - r.Add(1) - } - if x < size-1 { - time.Sleep(bucketDuration) - } - } - var result = r.Reduce(func(iterator Iterator) float64 { - var result float64 - for iterator.Next() { - bucket := iterator.Bucket() - result += bucket.Points[0] - } - return result - }) - if result != 6.0 { - t.Fatalf("Validate sum of points. result: %f", result) - } -} - -func TestRollingCounterDataRace(t *testing.T) { - size := 3 - bucketDuration := time.Millisecond * 10 - opts := RollingCounterOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingCounter(opts) - var stop = make(chan bool) - go func() { - for { - select { - case <-stop: - return - default: - r.Add(1) - time.Sleep(time.Millisecond * 5) - } - } - }() - go func() { - for { - select { - case <-stop: - return - default: - _ = r.Reduce(func(i Iterator) float64 { - for i.Next() { - bucket := i.Bucket() - for range bucket.Points { - continue - } - } - return 0 - }) - } - } - }() - time.Sleep(time.Second * 3) - close(stop) -} - -func BenchmarkRollingCounterIncr(b *testing.B) { - size := 3 - bucketDuration := time.Millisecond * 100 - opts := RollingCounterOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingCounter(opts) - b.ResetTimer() - for i := 0; i <= b.N; i++ { - r.Add(1) - } -} - -func BenchmarkRollingCounterReduce(b *testing.B) { - size := 3 - bucketDuration := time.Second - opts := RollingCounterOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingCounter(opts) - for i := 0; i <= 10; i++ { - r.Add(1) - time.Sleep(time.Millisecond * 500) - } - b.ResetTimer() - for i := 0; i <= b.N; i++ { - var _ = r.Reduce(func(i Iterator) float64 { - var result float64 - for i.Next() { - bucket := i.Bucket() - if len(bucket.Points) != 0 { - result += bucket.Points[0] - } - } - return result - }) - } -} diff --git a/metric/rolling_gauge.go b/metric/rolling_gauge.go deleted file mode 100644 index c065a02..0000000 --- a/metric/rolling_gauge.go +++ /dev/null @@ -1,62 +0,0 @@ -package metric - -import "time" - -var _ Metric = &rollingGauge{} -var _ Aggregation = &rollingGauge{} - -// RollingGauge represents a ring window based on time duration. -// e.g. [[1, 2], [1, 2, 3], [1,2, 3, 4]] -type RollingGauge interface { - Metric - Aggregation - // Reduce applies the reduction function to all buckets within the window. - Reduce(func(Iterator) float64) float64 -} - -// RollingGaugeOpts contains the arguments for creating RollingGauge. -type RollingGaugeOpts struct { - Size int - BucketDuration time.Duration -} - -type rollingGauge struct { - policy *RollingPolicy -} - -// NewRollingGauge creates a new RollingGauge baseed on RollingGaugeOpts. -func NewRollingGauge(opts RollingGaugeOpts) RollingGauge { - window := NewWindow(WindowOpts{Size: opts.Size}) - policy := NewRollingPolicy(window, RollingPolicyOpts{BucketDuration: opts.BucketDuration}) - return &rollingGauge{ - policy: policy, - } -} - -func (r *rollingGauge) Add(val int64) { - r.policy.Append(float64(val)) -} - -func (r *rollingGauge) Reduce(f func(Iterator) float64) float64 { - return r.policy.Reduce(f) -} - -func (r *rollingGauge) Avg() float64 { - return r.policy.Reduce(Avg) -} - -func (r *rollingGauge) Min() float64 { - return r.policy.Reduce(Min) -} - -func (r *rollingGauge) Max() float64 { - return r.policy.Reduce(Max) -} - -func (r *rollingGauge) Sum() float64 { - return r.policy.Reduce(Sum) -} - -func (r *rollingGauge) Value() int64 { - return int64(r.Sum()) -} diff --git a/metric/rolling_gauge_test.go b/metric/rolling_gauge_test.go deleted file mode 100644 index 825ea15..0000000 --- a/metric/rolling_gauge_test.go +++ /dev/null @@ -1,192 +0,0 @@ -package metric - -import ( - "math/rand" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestRollingGaugeAdd(t *testing.T) { - size := 3 - bucketDuration := time.Second - opts := RollingGaugeOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingGauge(opts) - listBuckets := func() [][]float64 { - buckets := make([][]float64, 0) - r.Reduce(func(i Iterator) float64 { - for i.Next() { - bucket := i.Bucket() - buckets = append(buckets, bucket.Points) - } - return 0.0 - }) - return buckets - } - assert.Equal(t, [][]float64{{}, {}, {}}, listBuckets()) - r.Add(1) - assert.Equal(t, [][]float64{{}, {}, {1}}, listBuckets()) - time.Sleep(time.Second) - r.Add(2) - r.Add(3) - assert.Equal(t, [][]float64{{}, {1}, {2, 3}}, listBuckets()) - time.Sleep(time.Second) - r.Add(4) - r.Add(5) - r.Add(6) - assert.Equal(t, [][]float64{{1}, {2, 3}, {4, 5, 6}}, listBuckets()) - time.Sleep(time.Second) - r.Add(7) - assert.Equal(t, [][]float64{{2, 3}, {4, 5, 6}, {7}}, listBuckets()) -} - -func TestRollingGaugeReset(t *testing.T) { - size := 3 - bucketDuration := time.Second - opts := RollingGaugeOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingGauge(opts) - listBuckets := func() [][]float64 { - buckets := make([][]float64, 0) - r.Reduce(func(i Iterator) float64 { - for i.Next() { - bucket := i.Bucket() - buckets = append(buckets, bucket.Points) - } - return 0.0 - }) - return buckets - } - r.Add(1) - time.Sleep(time.Second) - assert.Equal(t, [][]float64{{}, {1}}, listBuckets()) - time.Sleep(time.Second) - assert.Equal(t, [][]float64{{1}}, listBuckets()) - time.Sleep(time.Second) - assert.Equal(t, [][]float64{}, listBuckets()) - - // cross window - r.Add(1) - time.Sleep(time.Second * 5) - assert.Equal(t, [][]float64{}, listBuckets()) -} - -func TestRollingGaugeReduce(t *testing.T) { - size := 3 - bucketDuration := time.Second - opts := RollingGaugeOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingGauge(opts) - for x := 0; x < size; x = x + 1 { - for i := 0; i <= x; i++ { - r.Add(int64(i)) - } - if x < size-1 { - time.Sleep(bucketDuration) - } - } - var result = r.Reduce(func(i Iterator) float64 { - var result float64 - for i.Next() { - bucket := i.Bucket() - for _, point := range bucket.Points { - result += point - } - } - return result - }) - if result != 4.0 { - t.Fatalf("Validate sum of points. result: %f", result) - } -} - -func TestRollingGaugeDataRace(t *testing.T) { - size := 3 - bucketDuration := time.Second - opts := RollingGaugeOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingGauge(opts) - var stop = make(chan bool) - go func() { - for { - select { - case <-stop: - return - default: - r.Add(rand.Int63()) - time.Sleep(time.Millisecond * 5) - } - } - }() - go func() { - for { - select { - case <-stop: - return - default: - _ = r.Reduce(func(i Iterator) float64 { - for i.Next() { - bucket := i.Bucket() - for range bucket.Points { - continue - } - } - return 0 - }) - } - } - }() - time.Sleep(time.Second * 3) - close(stop) -} - -func BenchmarkRollingGaugeIncr(b *testing.B) { - size := 10 - bucketDuration := time.Second - opts := RollingGaugeOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingGauge(opts) - b.ResetTimer() - for i := 0; i <= b.N; i++ { - r.Add(1.0) - } -} - -func BenchmarkRollingGaugeReduce(b *testing.B) { - size := 10 - bucketDuration := time.Second - opts := RollingGaugeOpts{ - Size: size, - BucketDuration: bucketDuration, - } - r := NewRollingGauge(opts) - for i := 0; i <= 10; i++ { - r.Add(1.0) - time.Sleep(time.Millisecond * 500) - } - b.ResetTimer() - for i := 0; i <= b.N; i++ { - var _ = r.Reduce(func(i Iterator) float64 { - var result float64 - for i.Next() { - bucket := i.Bucket() - if len(bucket.Points) != 0 { - result += bucket.Points[0] - } - } - return result - }) - } -} diff --git a/metric/rolling_policy.go b/metric/rolling_policy.go deleted file mode 100644 index 13e5516..0000000 --- a/metric/rolling_policy.go +++ /dev/null @@ -1,100 +0,0 @@ -package metric - -import ( - "sync" - "time" -) - -// RollingPolicy is a policy for ring window based on time duration. -// RollingPolicy moves bucket offset with time duration. -// e.g. If the last point is appended one bucket duration ago, -// RollingPolicy will increment current offset. -type RollingPolicy struct { - mu sync.RWMutex - size int - window *Window - offset int - - bucketDuration time.Duration - lastAppendTime time.Time -} - -// RollingPolicyOpts contains the arguments for creating RollingPolicy. -type RollingPolicyOpts struct { - BucketDuration time.Duration -} - -// NewRollingPolicy creates a new RollingPolicy based on the given window and RollingPolicyOpts. -func NewRollingPolicy(window *Window, opts RollingPolicyOpts) *RollingPolicy { - return &RollingPolicy{ - window: window, - size: window.Size(), - offset: 0, - - bucketDuration: opts.BucketDuration, - lastAppendTime: time.Now(), - } -} - -func (r *RollingPolicy) timespan() int { - v := int(time.Since(r.lastAppendTime) / r.bucketDuration) - if v > -1 { // maybe time backwards - return v - } - return r.size -} - -func (r *RollingPolicy) add(f func(offset int, val float64), val float64) { - r.mu.Lock() - timespan := r.timespan() - if timespan > 0 { - r.lastAppendTime = r.lastAppendTime.Add(time.Duration(timespan * int(r.bucketDuration))) - offset := r.offset - // reset the expired buckets - s := offset + 1 - if timespan > r.size { - timespan = r.size - } - e, e1 := s+timespan, 0 // e: reset offset must start from offset+1 - if e > r.size { - e1 = e - r.size - e = r.size - } - for i := s; i < e; i++ { - r.window.ResetBucket(i) - offset = i - } - for i := 0; i < e1; i++ { - r.window.ResetBucket(i) - offset = i - } - r.offset = offset - } - f(r.offset, val) - r.mu.Unlock() -} - -// Append appends the given points to the window. -func (r *RollingPolicy) Append(val float64) { - r.add(r.window.Append, val) -} - -// Add adds the given value to the latest point within bucket. -func (r *RollingPolicy) Add(val float64) { - r.add(r.window.Add, val) -} - -// Reduce applies the reduction function to all buckets within the window. -func (r *RollingPolicy) Reduce(f func(Iterator) float64) (val float64) { - r.mu.RLock() - timespan := r.timespan() - if count := r.size - timespan; count > 0 { - offset := r.offset + timespan + 1 - if offset >= r.size { - offset = offset - r.size - } - val = f(r.window.Iterator(offset, count)) - } - r.mu.RUnlock() - return val -} diff --git a/metric/rolling_policy_test.go b/metric/rolling_policy_test.go deleted file mode 100644 index 2792605..0000000 --- a/metric/rolling_policy_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package metric - -import ( - "fmt" - "math/rand" - "testing" - "time" -) - -func GetRollingPolicy() *RollingPolicy { - w := NewWindow(WindowOpts{Size: 10}) - return NewRollingPolicy(w, RollingPolicyOpts{BucketDuration: 300 * time.Millisecond}) -} - -func Handler(t *testing.T, table []map[string][]int) { - for _, hm := range table { - var totalTs, lastOffset int - offsetAndPoints := hm["offsetAndPoints"] - timeSleep := hm["timeSleep"] - policy := GetRollingPolicy() - for i, n := range timeSleep { - totalTs += n - time.Sleep(time.Duration(n) * time.Millisecond) - policy.Add(1) - offset, points := offsetAndPoints[2*i], offsetAndPoints[2*i+1] - - if int(policy.window.window[offset].Points[0]) != points { - t.Errorf("error, time since last append: %vms, last offset: %v", totalTs, lastOffset) - } - lastOffset = offset - } - } -} - -func TestRollingPolicy_Add(t *testing.T) { - rand.Seed(time.Now().Unix()) - - // test add after 400ms and 601ms relative to the policy created time - policy := GetRollingPolicy() - time.Sleep(400 * time.Millisecond) - policy.Add(1) - time.Sleep(201 * time.Millisecond) - policy.Add(1) - for _, b := range policy.window.window { - fmt.Println(b.Points) - } - if int(policy.window.window[1].Points[0]) != 1 { - t.Errorf("error, time since last append: %vms, last offset: %v", 300, 0) - } - if int(policy.window.window[2].Points[0]) != 1 { - t.Errorf("error, time since last append: %vms, last offset: %v", 301, 0) - } - - // test func timespan return real span - table := []map[string][]int{ - { - "timeSleep": []int{294, 3200}, - "offsetAndPoints": []int{0, 1, 0, 1}, - }, - { - "timeSleep": []int{305, 3200, 6400}, - "offsetAndPoints": []int{1, 1, 1, 1, 1, 1}, - }, - } - - Handler(t, table) -} diff --git a/metric/window.go b/metric/window.go deleted file mode 100644 index e8a0d98..0000000 --- a/metric/window.go +++ /dev/null @@ -1,107 +0,0 @@ -package metric - -// Bucket contains multiple float64 points. -type Bucket struct { - Points []float64 - Count int64 - next *Bucket -} - -// Append appends the given value to the bucket. -func (b *Bucket) Append(val float64) { - b.Points = append(b.Points, val) - b.Count++ -} - -// Add adds the given value to the point. -func (b *Bucket) Add(offset int, val float64) { - b.Points[offset] += val - b.Count++ -} - -// Reset empties the bucket. -func (b *Bucket) Reset() { - b.Points = b.Points[:0] - b.Count = 0 -} - -// Next returns the next bucket. -func (b *Bucket) Next() *Bucket { - return b.next -} - -// Window contains multiple buckets. -type Window struct { - window []Bucket - size int -} - -// WindowOpts contains the arguments for creating Window. -type WindowOpts struct { - Size int -} - -// NewWindow creates a new Window based on WindowOpts. -func NewWindow(opts WindowOpts) *Window { - buckets := make([]Bucket, opts.Size) - for offset := range buckets { - buckets[offset] = Bucket{Points: make([]float64, 0)} - nextOffset := offset + 1 - if nextOffset == opts.Size { - nextOffset = 0 - } - buckets[offset].next = &buckets[nextOffset] - } - return &Window{window: buckets, size: opts.Size} -} - -// ResetWindow empties all buckets within the window. -func (w *Window) ResetWindow() { - for offset := range w.window { - w.ResetBucket(offset) - } -} - -// ResetBucket empties the bucket based on the given offset. -func (w *Window) ResetBucket(offset int) { - w.window[offset].Reset() -} - -// ResetBuckets empties the buckets based on the given offsets. -func (w *Window) ResetBuckets(offsets []int) { - for _, offset := range offsets { - w.ResetBucket(offset) - } -} - -// Append appends the given value to the bucket where index equals the given offset. -func (w *Window) Append(offset int, val float64) { - w.window[offset].Append(val) -} - -// Add adds the given value to the latest point within bucket where index equals the given offset. -func (w *Window) Add(offset int, val float64) { - if w.window[offset].Count == 0 { - w.window[offset].Append(val) - return - } - w.window[offset].Add(0, val) -} - -// Bucket returns the bucket where index equals the given offset. -func (w *Window) Bucket(offset int) Bucket { - return w.window[offset] -} - -// Size returns the size of the window. -func (w *Window) Size() int { - return w.size -} - -// Iterator returns the bucket iterator. -func (w *Window) Iterator(offset int, count int) Iterator { - return Iterator{ - count: count, - cur: &w.window[offset], - } -} diff --git a/metric/window_test.go b/metric/window_test.go deleted file mode 100644 index e49699a..0000000 --- a/metric/window_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package metric - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestWindowResetWindow(t *testing.T) { - opts := WindowOpts{Size: 3} - window := NewWindow(opts) - for i := 0; i < opts.Size; i++ { - window.Append(i, 1.0) - } - window.ResetWindow() - for i := 0; i < opts.Size; i++ { - assert.Equal(t, len(window.Bucket(i).Points), 0) - } -} - -func TestWindowResetBucket(t *testing.T) { - opts := WindowOpts{Size: 3} - window := NewWindow(opts) - for i := 0; i < opts.Size; i++ { - window.Append(i, 1.0) - } - window.ResetBucket(1) - assert.Equal(t, len(window.Bucket(1).Points), 0) - assert.Equal(t, window.Bucket(0).Points[0], float64(1.0)) - assert.Equal(t, window.Bucket(2).Points[0], float64(1.0)) -} - -func TestWindowResetBuckets(t *testing.T) { - opts := WindowOpts{Size: 3} - window := NewWindow(opts) - for i := 0; i < opts.Size; i++ { - window.Append(i, 1.0) - } - window.ResetBuckets([]int{0, 1, 2}) - for i := 0; i < opts.Size; i++ { - assert.Equal(t, len(window.Bucket(i).Points), 0) - } -} - -func TestWindowAppend(t *testing.T) { - opts := WindowOpts{Size: 3} - window := NewWindow(opts) - for i := 0; i < opts.Size; i++ { - window.Append(i, 1.0) - } - for i := 0; i < opts.Size; i++ { - assert.Equal(t, window.Bucket(i).Points[0], float64(1.0)) - } -} - -func TestWindowAdd(t *testing.T) { - opts := WindowOpts{Size: 3} - window := NewWindow(opts) - window.Append(0, 1.0) - window.Add(0, 1.0) - assert.Equal(t, window.Bucket(0).Points[0], float64(2.0)) -} - -func TestWindowSize(t *testing.T) { - opts := WindowOpts{Size: 3} - window := NewWindow(opts) - assert.Equal(t, window.Size(), 3) -} diff --git a/ratelimiter/bbr/bbr.go b/ratelimiter/bbr/bbr.go index 2c909f9..22a3693 100644 --- a/ratelimiter/bbr/bbr.go +++ b/ratelimiter/bbr/bbr.go @@ -5,9 +5,9 @@ import ( "sync/atomic" "time" - "github.com/xiaojiaoyu100/lizard/cpukit" - "github.com/xiaojiaoyu100/lizard/group" - "github.com/xiaojiaoyu100/lizard/metric" + "github.com/go-kratos/kratos/pkg/container/group" + "github.com/go-kratos/kratos/pkg/stat/metric" + cpustat "github.com/go-kratos/kratos/pkg/stat/sys/cpu" "github.com/xiaojiaoyu100/lizard/ratelimiter" ) @@ -39,8 +39,8 @@ func cpuproc(logger ratelimiter.Logger) { // EMA algorithm: https://blog.csdn.net/m0_38106113/article/details/81542863 for range ticker.C { - stat := &cpukit.Stat{} - cpukit.ReadStat(stat) + stat := &cpustat.Stat{} + cpustat.ReadStat(stat) prevCpu := atomic.LoadInt64(&cpu) curCpu := int64(float64(prevCpu)*decay + float64(stat.Usage)*(1.0-decay)) atomic.StoreInt64(&cpu, curCpu) @@ -246,7 +246,8 @@ type Group struct { } // NewGroup new a limiter group container, if conf nil use default conf. -func NewGroup(conf *Config) *Group { +func NewGroup(conf *Config, logger ratelimiter.Logger) *Group { + go cpuproc(logger) if conf == nil { conf = defaultConf } diff --git a/ratelimiter/limitermiddleware/gin_middleware.go b/ratelimiter/limitermiddleware/gin_middleware.go index e6aafea..326a858 100644 --- a/ratelimiter/limitermiddleware/gin_middleware.go +++ b/ratelimiter/limitermiddleware/gin_middleware.go @@ -20,7 +20,7 @@ type LimiterMiddleware struct { func NewLimiterMiddleware(conf *bbr.Config, logger ratelimiter.Logger, abortHttpErr interface{}) *LimiterMiddleware { return &LimiterMiddleware{ - limiterGroup: bbr.NewGroup(conf), + limiterGroup: bbr.NewGroup(conf, logger), abortHttpErr: abortHttpErr, logger: logger, }