Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
33161d92ac | |||
30b584f0bd | |||
98a6e56cb8 | |||
54fcd232bd | |||
8b94a0d256 | |||
38247cf3c9 | |||
36a085eccb | |||
|
e0682ed122 | ||
|
cd85fd66ff | ||
|
3c03b5c497 | ||
|
cd94900f19 | ||
|
ce9ab060d9 | ||
|
c653a48667 | ||
|
8c78c2a6e2 | ||
|
3a09faf4b8 | ||
|
8998a4938d | ||
|
01c35869b8 | ||
|
1d9b78eb37 | ||
|
b3a1b78006 | ||
|
c014aca84b | ||
|
4843033fe0 | ||
|
5e9f6ee73f | ||
|
27ff5fb3db | ||
|
eebd6500f3 | ||
|
d6024cf64c | ||
|
1e57935100 | ||
|
e6655504e9 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@
|
|||||||
out
|
out
|
||||||
gen
|
gen
|
||||||
runtime
|
runtime
|
||||||
|
/vendor
|
75
README.md
75
README.md
@ -1,21 +1,21 @@
|
|||||||
# grlogs
|
# grlogs
|
||||||
本库为争游内部日志公共库
|
本库为争游内部日志公共库, 该库基于 beegoLogger 基础上完善, 目前支持的引擎有 file、console、net、smtp、es、alisls
|
||||||
|
|
||||||
## 代码示例
|
## 代码示例
|
||||||
|
|
||||||
1. 引入
|
1. 引入
|
||||||
```go
|
```
|
||||||
import "golib.gaore.com/GaoreGo/grlogs"
|
import "golib.gaore.com/GaoreGo/haiwai-grlogs"
|
||||||
```
|
```
|
||||||
2. 简单用法
|
2. 简单用法
|
||||||
```go
|
```
|
||||||
grlogs.Get("test", 128).Info("hello word")
|
grlogs.Get("test", 128).Info("hello word")
|
||||||
grlogs.Get("test").Warning("hello word")
|
grlogs.Get("test").Warning("hello word")
|
||||||
```
|
```
|
||||||
`Get` 方法中 `lable` 参数为标签,为识别分类所用,在Grlogs里一个分类使用一个管道进行日志
|
`Get` 方法中 `lable` 参数为标签,为识别分类所用,在Grlogs里一个分类使用一个管道进行日志
|
||||||
|
|
||||||
3. 进阶用法
|
3. 进阶用法
|
||||||
```go
|
```
|
||||||
logger := grlogs.GetEs("wifi")
|
logger := grlogs.GetEs("wifi")
|
||||||
logger.SetAdapter(LevelAll, AdapterElasticSearch)
|
logger.SetAdapter(LevelAll, AdapterElasticSearch)
|
||||||
logger.SetAdapter(LevelInfo, AdapterFile)
|
logger.SetAdapter(LevelInfo, AdapterFile)
|
||||||
@ -23,9 +23,70 @@ logger.Critical("出错了")
|
|||||||
logger.Info("出错了")
|
logger.Info("出错了")
|
||||||
```
|
```
|
||||||
|
|
||||||
4. 如果需要写入es, 必须设置环境变量 `GRLOG_APP_NAME`, 不能有反斜杠, 如
|
4. 如果需要写入es 或 alils, 必须设置环境变量 `GRLOG_APP_NAME`, 不能有反斜杠, 如
|
||||||
```shell script
|
```shell script
|
||||||
export GRLOG_APP_NAME=mkt.gaore.com;
|
export GRLOG_APP_NAME=mkt.gaore.com;
|
||||||
```
|
```
|
||||||
|
还需要额外引入es库,完成初始化动作
|
||||||
|
```go
|
||||||
|
import _ "golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs/es"
|
||||||
|
```
|
||||||
|
|
||||||
5. 文件日志会写入到 `./runtime/logs/` 文件夹 请务必在项目构建阶段创建该目录
|
```go
|
||||||
|
import _ "golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs/alils"
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 文件日志会写入到 `./runtime/logs/` 文件夹 **请务必在项目构建阶段创建该目录**
|
||||||
|
|
||||||
|
|
||||||
|
6. `AliLS` 日志接入的是阿里SLS GOSDK , 下面是关于 [https://github.com/aliyun/aliyun-log-go-sdk/tree/master/producer] 描述
|
||||||
|
|
||||||
|
producer提供了两种关闭模式,分为有限关闭和安全关闭,安全关闭会等待producer中缓存的所有的数据全部发送完成以后在关闭producer,有限关闭会接收用户传递的一个参数值,时间单位为秒,当开始关闭producer的时候开始计时,超过传递的设定值还未能完全关闭producer的话会强制退出producer,此时可能会有部分数据未被成功发送而丢失。
|
||||||
|
|
||||||
|
所以用了aliLS 的 adapter 时,最好调用`grlogs.Close()` 或 `grlogs.CloseAll()` 方法安全关闭通道,以刷新缓冲区
|
||||||
|
|
||||||
|
7. 完整示例
|
||||||
|
```go
|
||||||
|
package grlogs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
_ "golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs/es"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetLogger(t *testing.T) {
|
||||||
|
// 新建 channel 大小为128 标识为nds 日志通道 , Get 的方法 默认带 console 和 file 输出
|
||||||
|
l := grlogs.Get("nds", 128).SetAdapter(LevelAll, AdapterElasticSearch)
|
||||||
|
l.Debug("我正在调试")
|
||||||
|
l.Critical("出错了")
|
||||||
|
|
||||||
|
// 复用 nds 的日志通道
|
||||||
|
grlogs.Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
|
||||||
|
grlogs.Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
|
||||||
|
|
||||||
|
// 新建 channel 大小为默认 标识为wifi 日志通道 , GetEs 的方法 默认带 console 和 file 和 elatisearch 输出
|
||||||
|
grlogs.GetEs("wifi")
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
grlogs.Get("wifi").Warning("Warning")
|
||||||
|
grlogs.Get("wifi").Warn("Warn")
|
||||||
|
grlogs.Get("wifi").Debug("Debug")
|
||||||
|
grlogs.Get("wifi").Error("Error")
|
||||||
|
grlogs.Get("wifi").Notice("Notice")
|
||||||
|
grlogs.Get("wifi").Info("Info")
|
||||||
|
grlogs.Get("wifi").Alert("Alert")
|
||||||
|
}
|
||||||
|
|
||||||
|
Get("wifi").Critical("neoweiwoewe")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDropAdapter(t *testing.T) {
|
||||||
|
grlogs.SetAdapter(LevelAll, AdapterAliLs)
|
||||||
|
grlogs.DropAdapter(AdapterAliLs)
|
||||||
|
grlogs.Informational(errors.New("he hello"))
|
||||||
|
grlogs.SetAdapter(LevelAll, AdapterAliLs)
|
||||||
|
grlogs.Debug(errors.New("he hello"))
|
||||||
|
grlogs.CloseAll()
|
||||||
|
}
|
||||||
|
```
|
17
config.go
17
config.go
@ -54,3 +54,20 @@ func (c *EsConfig) String() string {
|
|||||||
b, _ := json.Marshal(c)
|
b, _ := json.Marshal(c)
|
||||||
return bytes.NewBuffer(b).String()
|
return bytes.NewBuffer(b).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AliLSConfig struct {
|
||||||
|
Project string `json:"project"`
|
||||||
|
Endpoint string `json:"endpoint"`
|
||||||
|
KeyID string `json:"key_id"`
|
||||||
|
KeySecret string `json:"key_secret"`
|
||||||
|
LogStore string `json:"log_store"`
|
||||||
|
Topics []string `json:"topics"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
Level Level `json:"level"`
|
||||||
|
FlushWhen int `json:"flush_when"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *AliLSConfig) String() string {
|
||||||
|
b, _ := json.Marshal(c)
|
||||||
|
return bytes.NewBuffer(b).String()
|
||||||
|
}
|
||||||
|
113
funtion.go
113
funtion.go
@ -5,9 +5,21 @@ import (
|
|||||||
"github.com/astaxie/beego/logs"
|
"github.com/astaxie/beego/logs"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var adatperMapper = map[Adapter]func(l *Logger, level Level) error{
|
var adatperSetMapper = map[Adapter]func(l *Logger, level Level) error{
|
||||||
|
|
||||||
|
AdapterSocket: func(l *Logger, level Level) error {
|
||||||
|
c := ConnLogConfig{
|
||||||
|
ReconnectOnMsg: false,
|
||||||
|
Reconnect: true,
|
||||||
|
Net: "",
|
||||||
|
Addr: "127.0.0.1:9888",
|
||||||
|
Level: level,
|
||||||
|
}
|
||||||
|
return l.SetLogger(logs.AdapterConn, c.String())
|
||||||
|
},
|
||||||
|
|
||||||
AdapterFile: func(l *Logger, level Level) error {
|
AdapterFile: func(l *Logger, level Level) error {
|
||||||
if wd, err := os.Getwd(); err == nil {
|
if wd, err := os.Getwd(); err == nil {
|
||||||
@ -33,20 +45,105 @@ var adatperMapper = map[Adapter]func(l *Logger, level Level) error{
|
|||||||
},
|
},
|
||||||
|
|
||||||
AdapterElasticSearch: func(l *Logger, level Level) error {
|
AdapterElasticSearch: func(l *Logger, level Level) error {
|
||||||
|
c := GenEsConfig(level)
|
||||||
|
return l.SetLogger(logs.AdapterEs, c.String())
|
||||||
|
},
|
||||||
|
|
||||||
dsn := "http://es-cn-0pp1mm3hq000dnbh4.public.elasticsearch.aliyuncs.com:9200/"
|
AdapterAliLs: func(l *Logger, level Level) error {
|
||||||
if envkey == "prod" || envkey == "" || envkey == "gray" {
|
c := GenAliConfig(level)
|
||||||
dsn = "http://es-cn-0pp1mm3hq000dnbh4.elasticsearch.aliyuncs.com:9200/"
|
return l.SetLogger(logs.AdapterAliLS, c.String())
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
c := EsConfig{
|
func GenAliConfig(level Level) *AliLSConfig {
|
||||||
Username: "elastic",
|
var project = "gr-go-project"
|
||||||
Password: "Hellogaore@",
|
var endpoint string
|
||||||
|
|
||||||
|
intranet := os.Getenv("GRLOG_INTERNET") != "public"
|
||||||
|
if intranet && (os.Getenv(envKey) == "development" || os.Getenv(envKey) == "testing") {
|
||||||
|
intranet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if intranet {
|
||||||
|
endpoint = "cn-hongkong-intranet.log.aliyuncs.com"
|
||||||
|
} else {
|
||||||
|
endpoint = "cn-hongkong.log.aliyuncs.com"
|
||||||
|
}
|
||||||
|
source := os.Getenv("GRLOG_SOURCE")
|
||||||
|
appName := os.Getenv("GRLOG_APP_NAME")
|
||||||
|
topic := os.Getenv("GRLOG_TOPIC")
|
||||||
|
if topic == "" {
|
||||||
|
topic = appName
|
||||||
|
}
|
||||||
|
c := &AliLSConfig{
|
||||||
|
Project: project,
|
||||||
|
Endpoint: endpoint,
|
||||||
|
KeyID: "LTAI5tMA7iMGFfuc3xSRVCGQ",
|
||||||
|
KeySecret: "z98EpzmYmgiVLKizxP7pMF4BPbHfPV",
|
||||||
|
LogStore: appName,
|
||||||
|
Topics: []string{topic},
|
||||||
|
Source: source,
|
||||||
|
Level: level,
|
||||||
|
FlushWhen: 0,
|
||||||
|
}
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func GenEsConfig(level Level) *EsConfig {
|
||||||
|
dsn := "http://es-cn-tl32xlfmu00015h34.public.elasticsearch.aliyuncs.com:9200/"
|
||||||
|
if os.Getenv(envKey) == "production" || os.Getenv(envKey) == "" || os.Getenv(envKey) == "gray" {
|
||||||
|
dsn = "http://es-cn-tl32xlfmu00015h34.elasticsearch.aliyuncs.com:9200/"
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &EsConfig{
|
||||||
|
Username: "kaifa_api",
|
||||||
|
Password: "2quYX3bTeahO",
|
||||||
Dsn: dsn,
|
Dsn: dsn,
|
||||||
Level: level,
|
Level: level,
|
||||||
Index: os.Getenv("GRLOG_APP_NAME"),
|
Index: os.Getenv("GRLOG_APP_NAME"),
|
||||||
}
|
}
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
return l.SetLogger(logs.AdapterEs, c.String())
|
var adatperDropMapper = map[Adapter]func(l *Logger) error{
|
||||||
|
|
||||||
|
AdapterAliLs: func(l *Logger) error {
|
||||||
|
return l.BeeLogger.DelLogger(logs.AdapterAliLS)
|
||||||
|
},
|
||||||
|
|
||||||
|
AdapterFile: func(l *Logger) error {
|
||||||
|
return l.BeeLogger.DelLogger(logs.AdapterFile)
|
||||||
|
},
|
||||||
|
|
||||||
|
AdapterConsole: func(l *Logger) error {
|
||||||
|
return l.BeeLogger.DelLogger(logs.AdapterConsole)
|
||||||
|
},
|
||||||
|
|
||||||
|
AdapterElasticSearch: func(l *Logger) error {
|
||||||
|
return l.BeeLogger.DelLogger(logs.AdapterEs)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func formatLog(f interface{}, v ...interface{}) string {
|
||||||
|
var msg string
|
||||||
|
switch f.(type) {
|
||||||
|
case string:
|
||||||
|
msg = f.(string)
|
||||||
|
if len(v) == 0 {
|
||||||
|
return msg
|
||||||
|
}
|
||||||
|
if strings.Contains(msg, "%") && !strings.Contains(msg, "%%") {
|
||||||
|
//format string
|
||||||
|
} else {
|
||||||
|
//do not contain format char
|
||||||
|
msg += strings.Repeat(" %v", len(v))
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
msg = fmt.Sprint(f)
|
||||||
|
if len(v) == 0 {
|
||||||
|
return msg
|
||||||
|
}
|
||||||
|
msg += strings.Repeat(" %v", len(v))
|
||||||
|
}
|
||||||
|
return fmt.Sprintf(msg, v...)
|
||||||
|
}
|
||||||
|
27
go.mod
Normal file
27
go.mod
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
module golib.gaore.com/GaoreGo/haiwai-grlogs/v2
|
||||||
|
|
||||||
|
go 1.15
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/aliyun/aliyun-log-go-sdk v0.1.43
|
||||||
|
github.com/astaxie/beego v1.12.3
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18
|
||||||
|
golib.gaore.com/GaoreGo/goes v1.2.4
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/OwnLocal/goes v1.0.0 // indirect
|
||||||
|
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||||
|
github.com/go-kit/kit v0.10.0 // indirect
|
||||||
|
github.com/go-logfmt/logfmt v0.5.0 // indirect
|
||||||
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/golang/protobuf v1.4.2 // indirect
|
||||||
|
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
go.uber.org/atomic v1.5.0 // indirect
|
||||||
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
|
||||||
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect
|
||||||
|
google.golang.org/protobuf v1.25.0 // indirect
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||||
|
)
|
488
go.sum
Normal file
488
go.sum
Normal file
@ -0,0 +1,488 @@
|
|||||||
|
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 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||||
|
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||||
|
github.com/OwnLocal/goes v1.0.0 h1:81QQ3z6dvLhgXlkNpLkaYhk8jiKS7saFG01xy039KaU=
|
||||||
|
github.com/OwnLocal/goes v1.0.0/go.mod h1:8rIFjBGTue3lCU0wplczcUgt9Gxgrkkrw7etMIcn8TM=
|
||||||
|
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||||
|
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||||
|
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
|
||||||
|
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||||
|
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
|
||||||
|
github.com/aliyun/aliyun-log-go-sdk v0.1.43 h1:AmP2wVKjStvEEinj4aBiZFMchg4miIcOQ1fNwEK+5bA=
|
||||||
|
github.com/aliyun/aliyun-log-go-sdk v0.1.43/go.mod h1:1QQ59pEJiVVXqKgbHcU6FWIgxT5RKBt+CT8AiQ2bEts=
|
||||||
|
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/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||||
|
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=
|
||||||
|
github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ=
|
||||||
|
github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA=
|
||||||
|
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
|
||||||
|
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||||
|
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||||
|
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
|
||||||
|
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
||||||
|
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
|
||||||
|
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||||
|
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
|
||||||
|
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
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/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg=
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||||
|
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/go-semver v0.2.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/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
|
github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
|
||||||
|
github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
|
||||||
|
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||||
|
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
||||||
|
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/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/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 v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
|
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
|
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
|
||||||
|
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
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/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/frankban/quicktest v1.10.2 h1:19ARM85nVi4xH7xPXuc5eM/udya5ieh7b/Sv+d844Tk=
|
||||||
|
github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
|
||||||
|
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 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo=
|
||||||
|
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
|
||||||
|
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 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
|
||||||
|
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||||
|
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
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.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
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/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||||
|
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||||
|
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||||
|
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||||
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||||
|
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.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||||
|
github.com/google/go-cmp v0.5.2/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/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/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||||
|
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/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=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||||
|
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||||
|
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
|
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/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
|
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=
|
||||||
|
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||||
|
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-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||||
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
|
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||||
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
|
||||||
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
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/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
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-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
|
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
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-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=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
|
||||||
|
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
|
||||||
|
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
|
||||||
|
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
|
||||||
|
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=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
||||||
|
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||||
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||||
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
|
||||||
|
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=
|
||||||
|
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
|
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
|
||||||
|
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/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.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
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/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||||
|
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/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A=
|
||||||
|
github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
|
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.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
|
||||||
|
github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
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.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
|
||||||
|
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/prometheus/procfs v0.0.0-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.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||||
|
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||||
|
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1/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-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||||
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
|
||||||
|
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
|
||||||
|
github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
|
||||||
|
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
|
||||||
|
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/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=
|
||||||
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
|
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
|
||||||
|
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||||
|
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
|
||||||
|
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=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
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/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||||
|
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||||
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
|
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
|
||||||
|
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/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
||||||
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
|
||||||
|
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
|
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
|
||||||
|
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.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
|
||||||
|
go.uber.org/atomic v1.5.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/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=
|
||||||
|
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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
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=
|
||||||
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
||||||
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||||
|
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
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-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
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-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/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-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
||||||
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/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-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-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ=
|
||||||
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
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/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=
|
||||||
|
golib.gaore.com/GaoreGo/goes v1.2.4 h1:l/DJJrsuCjkLnXKA2nhAQOuado10PFHXfMw3s4y9Mpg=
|
||||||
|
golib.gaore.com/GaoreGo/goes v1.2.4/go.mod h1:KhnsyAIxlz+9Bpxp6yuSS8Ncm0GRyF5H1oNiurLm03k=
|
||||||
|
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/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-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
|
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=
|
||||||
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
|
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
|
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.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
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=
|
||||||
|
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||||
|
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||||
|
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||||
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/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/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
|
||||||
|
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=
|
||||||
|
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||||
|
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.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 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
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=
|
||||||
|
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
|
59
grlogs.go
Normal file
59
grlogs.go
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package grlogs
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
func Info(v ...interface{}) {
|
||||||
|
Get("grlogs").Info(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Informational(v ...interface{}) {
|
||||||
|
Get("grlogs").Informational(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Warning(v ...interface{}) {
|
||||||
|
Get("grlogs").Warning(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Warn(v ...interface{}) {
|
||||||
|
Get("grlogs").Warn(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Notice(v ...interface{}) {
|
||||||
|
Get("grlogs").Notice(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Error(v ...interface{}) {
|
||||||
|
Get("grlogs").Error(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Critical(v ...interface{}) {
|
||||||
|
Get("grlogs").Critical(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Alert(v ...interface{}) {
|
||||||
|
Get("grlogs").Alert(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Emergency(v ...interface{}) {
|
||||||
|
Get("grlogs").Emergency(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Trace(v ...interface{}) {
|
||||||
|
Get("grlogs").Trace(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Debug(v ...interface{}) {
|
||||||
|
Get("grlogs").Debug(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateFmtStr(n int) string {
|
||||||
|
return strings.Repeat("%v ", n)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetAdapter(level Level, adapter Adapter) {
|
||||||
|
Get("grlogs").SetAdapter(level, adapter)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DropAdapter(adapter Adapter) {
|
||||||
|
Get("grlogs").DropAdapter(adapter)
|
||||||
|
}
|
145
log.go
145
log.go
@ -2,22 +2,31 @@ package grlogs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"golib.gaore.com/GaoreGo/grlogs/logs"
|
"golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
var loggers = sync.Map{}
|
var loggers = sync.Map{}
|
||||||
|
|
||||||
var envkey = "CENTER_RUNMODE"
|
var runmode = "CENTER_RUNMODE"
|
||||||
|
var envKey = "GAORE_ENVIRONMENT"
|
||||||
|
|
||||||
|
var defaultModeMapping = map[string][]AdapterTupple{
|
||||||
|
"es": []AdapterTupple{{LevelAll, AdapterConsole}, {LevelAll, AdapterElasticSearch}},
|
||||||
|
"ali": []AdapterTupple{{LevelAll, AdapterConsole}, {LevelAll, AdapterAliLs}},
|
||||||
|
"": []AdapterTupple{{LevelAll, AdapterConsole}, {LevelAll, AdapterFile}},
|
||||||
|
}
|
||||||
|
|
||||||
type Logger struct {
|
type Logger struct {
|
||||||
Lable string
|
Lable string
|
||||||
*logs.BeeLogger
|
*logs.BeeLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Getter func() *Logger
|
||||||
|
|
||||||
func (self *Logger) SetAdapter(level Level, adapter Adapter) *Logger {
|
func (self *Logger) SetAdapter(level Level, adapter Adapter) *Logger {
|
||||||
if call, ok := adatperMapper[adapter]; ok {
|
if call, ok := adatperSetMapper[adapter]; ok {
|
||||||
if err := call(self, level); err != nil {
|
if err := call(self, level); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
@ -25,51 +34,119 @@ func (self *Logger) SetAdapter(level Level, adapter Adapter) *Logger {
|
|||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(label string, channelLens ...int64) (l *Logger, loaded bool) {
|
func (self *Logger) DropAdapter(adapter Adapter) *Logger {
|
||||||
var channellens int64
|
if call, ok := adatperDropMapper[adapter]; ok {
|
||||||
var tmp interface{}
|
if err := call(self); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
tmp, loaded = loggers.LoadOrStore(label, new(Logger))
|
}
|
||||||
l = tmp.(*Logger)
|
}
|
||||||
if len(channelLens) > 0 {
|
return self
|
||||||
channellens = channelLens[0]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !loaded {
|
func newLoggerFromMap(label string, defaultmode string, channelLens ...int64) Getter {
|
||||||
|
|
||||||
|
if tmp, ok := loggers.Load(label); ok {
|
||||||
|
return tmp.(Getter)
|
||||||
|
}
|
||||||
|
|
||||||
|
var l *Logger
|
||||||
|
var once sync.Once
|
||||||
|
wapperGetter := Getter(func() *Logger {
|
||||||
|
once.Do(func() {
|
||||||
|
|
||||||
|
var channelLensNum int64 = 100
|
||||||
|
if len(channelLens) > 0 && channelLens[0] > 0 {
|
||||||
|
channelLensNum = channelLens[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
l = &Logger{BeeLogger: logs.NewLogger(channelLensNum)}
|
||||||
l.Lable = label
|
l.Lable = label
|
||||||
l.BeeLogger = logs.NewLogger(channellens)
|
l.BeeLogger = logs.NewLogger(channelLensNum)
|
||||||
l.BeeLogger.Lable = label
|
l.BeeLogger.Label = label
|
||||||
l.Env = os.Getenv(envkey)
|
l.Env = os.Getenv(envKey)
|
||||||
l.SetPrefix(fmt.Sprintf("[env:%s logger:%s]", os.Getenv(envkey), label))
|
l.SetPrefix(fmt.Sprintf("[env:%s logger:%s]", l.Env, label))
|
||||||
l.EnableFuncCallDepth(true)
|
l.EnableFuncCallDepth(true)
|
||||||
l.SetLogFuncCallDepth(2)
|
l.SetLogFuncCallDepth(2)
|
||||||
|
if mode, ok := defaultModeMapping[defaultmode]; ok {
|
||||||
|
for _, v := range mode {
|
||||||
|
l.SetAdapter(v.Level, v.Adapter)
|
||||||
}
|
}
|
||||||
return
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return l
|
||||||
|
})
|
||||||
|
|
||||||
|
tmp, loaded := loggers.LoadOrStore(label, wapperGetter)
|
||||||
|
if loaded {
|
||||||
|
return tmp.(Getter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Get(label string, channelLens ...int64) (l *Logger) {
|
return wapperGetter
|
||||||
var filelevel Level = LevelInfo
|
|
||||||
var loaded bool
|
|
||||||
if os.Getenv(envkey) == "dev" {
|
|
||||||
filelevel = LevelAll
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if l, loaded = New(label, channelLens...); !loaded {
|
func Get(label string, channelLens ...int64) *Logger {
|
||||||
l.SetAdapter(filelevel, AdapterFile).SetAdapter(LevelAll, AdapterConsole)
|
getter := newLoggerFromMap(label, "", channelLens...)
|
||||||
}
|
return getter()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetEs(label string, channelLens ...int64) (l *Logger) {
|
func GetEs(label string, channelLens ...int64) *Logger {
|
||||||
var filelevel Level = LevelInfo
|
getter := newLoggerFromMap(label, "es", channelLens...)
|
||||||
var loaded bool
|
return getter()
|
||||||
if os.Getenv(envkey) == "dev" {
|
|
||||||
filelevel = LevelAll
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if l, loaded = New(label, channelLens...); !loaded {
|
func GetAli(label string, channelLens ...int64) *Logger {
|
||||||
l.SetAdapter(filelevel, AdapterFile).SetAdapter(LevelAll, AdapterConsole).SetAdapter(filelevel, AdapterElasticSearch)
|
getter := newLoggerFromMap(label, "ali", channelLens...)
|
||||||
|
return getter()
|
||||||
}
|
}
|
||||||
return
|
|
||||||
|
func Close(lables ...string) {
|
||||||
|
wg := &sync.WaitGroup{}
|
||||||
|
for _, lable := range lables {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(lable string) {
|
||||||
|
if v, ok := loggers.Load(lable); ok {
|
||||||
|
if tmp, ok := v.(*Logger); ok {
|
||||||
|
loggers.Delete(lable)
|
||||||
|
tmp.BeeLogger.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wg.Done()
|
||||||
|
}(lable)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CloseAll() {
|
||||||
|
wg := &sync.WaitGroup{}
|
||||||
|
loggers.Range(func(key, value interface{}) bool {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
if tmp, ok := value.(*Logger); ok {
|
||||||
|
tmp.BeeLogger.Close()
|
||||||
|
loggers.Delete(key)
|
||||||
|
}
|
||||||
|
wg.Done()
|
||||||
|
}()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
var level Level = LevelInfo
|
||||||
|
if os.Getenv(runmode) == "dev" {
|
||||||
|
level = LevelAll
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultModeMapping["es"] = []AdapterTupple{{level, AdapterConsole}, {level, AdapterElasticSearch}}
|
||||||
|
defaultModeMapping[""] = []AdapterTupple{{level, AdapterConsole}, {level, AdapterFile}}
|
||||||
|
defaultModeMapping["ali"] = []AdapterTupple{{level, AdapterConsole}}
|
||||||
|
env := os.Getenv(envKey)
|
||||||
|
if env == "production" || env == "gray" || os.Getenv("GRLOG_INTERNET") == "public" {
|
||||||
|
defaultModeMapping["ali"] = append(defaultModeMapping["ali"], AdapterTupple{level, AdapterAliLs})
|
||||||
|
} else {
|
||||||
|
defaultModeMapping["ali"] = append(defaultModeMapping["ali"], AdapterTupple{level, AdapterFile})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
87
log_test.go
87
log_test.go
@ -1,23 +1,104 @@
|
|||||||
package grlogs
|
package grlogs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "golib.gaore.com/GaoreGo/grlogs/logs/es"
|
"errors"
|
||||||
|
_ "golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs/alils"
|
||||||
|
_ "golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs/es"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetLogger(t *testing.T) {
|
func TestGetLogger(t *testing.T) {
|
||||||
|
// 新建 channel 大小为128 标识为nds 日志通道 , Get 的方法 默认带 console 和 file 输出
|
||||||
l := Get("nds", 128).SetAdapter(LevelAll, AdapterElasticSearch)
|
l := Get("nds", 128).SetAdapter(LevelAll, AdapterElasticSearch)
|
||||||
l.Debug("我正在调试")
|
l.Debug("我正在调试")
|
||||||
l.Critical("出错了")
|
l.Critical("出错了")
|
||||||
|
|
||||||
|
// 复用 nds 的日志通道
|
||||||
|
Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
|
||||||
Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
|
Get("nds").Warning("hadoee %s", time.Now().Format(time.RFC1123))
|
||||||
|
|
||||||
|
// 新建 channel 大小为默认 标识为wifi 日志通道 , GetEs 的方法 默认带 console 和 file 和 elatisearch 输出
|
||||||
GetEs("wifi")
|
GetEs("wifi")
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
Get("wifi").Error("neoweiwoewe")
|
Get("wifi").Warning("Warning")
|
||||||
|
Get("wifi").Warn("Warn")
|
||||||
|
Get("wifi").Debug("Debug")
|
||||||
|
Get("wifi").Error("Error")
|
||||||
|
Get("wifi").Notice("Notice")
|
||||||
|
Get("wifi").Info("Info")
|
||||||
|
Get("wifi").Alert("Alert")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Get("wifi").Critical("neoweiwoewe")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetAliLs(t *testing.T) {
|
||||||
|
|
||||||
|
lable := "test_alils"
|
||||||
|
l := GetAli(lable).Async(128)
|
||||||
|
|
||||||
|
for i := 0; i < 2; i++ {
|
||||||
|
l.Info("Info")
|
||||||
|
l.Debug("Debug")
|
||||||
|
l.Warn("Warn")
|
||||||
|
l.Warning("Warning")
|
||||||
|
l.Error("Error")
|
||||||
|
l.Error("Error\n\n 测试换行")
|
||||||
|
l.Warn("Warn")
|
||||||
|
}
|
||||||
|
|
||||||
|
time.Sleep(time.Hour * 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDropAdapter(t *testing.T) {
|
||||||
|
SetAdapter(LevelAll, AdapterAliLs)
|
||||||
|
DropAdapter(AdapterAliLs)
|
||||||
|
Informational(errors.New("he hello"))
|
||||||
|
SetAdapter(LevelAll, AdapterAliLs)
|
||||||
|
Debug(errors.New("he hello"))
|
||||||
|
CloseAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNew(t *testing.T) {
|
||||||
|
os.Setenv("CENTER_RUNMODE", "dev")
|
||||||
|
os.Setenv("GRLOG_APP_NAME", "yoda")
|
||||||
|
os.Setenv("GRLOG_ALILS_DEBUG", "on")
|
||||||
|
t.Log("GRLOG_INTERNET:" + os.Getenv("GRLOG_INTERNET"))
|
||||||
|
t.Log("GAORE_ENVIRONMENT:" + os.Getenv("GAORE_ENVIRONMENT"))
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
GetAli("ok").Info("%d", i)
|
||||||
|
time.Sleep(10 * time.Second)
|
||||||
|
wg.Done()
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
GetAli("ok").Debug("aaaaaa%d", i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetEs(t *testing.T) {
|
func TestGetEs(t *testing.T) {
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
GetEs("ok").Debug("%d", i)
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
|
wg.Done()
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
GetEs("ok").Debug("aaaaaa%d", i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,24 @@ package alils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strings"
|
"fmt"
|
||||||
"sync"
|
"github.com/aliyun/aliyun-log-go-sdk/producer"
|
||||||
|
"golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs"
|
||||||
|
"os"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
|
||||||
"golib.gaore.com/GaoreGo/grlogs/logs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
func NewAliLS() logs.Logger {
|
||||||
// CacheSize set the flush size
|
cw := &alilsLogger{
|
||||||
CacheSize int = 64
|
Level: logs.LevelDebug,
|
||||||
// Delimiter define the topic delimiter
|
}
|
||||||
Delimiter string = "##"
|
return cw
|
||||||
)
|
}
|
||||||
|
|
||||||
// Config is the Config for Ali Log
|
type alilsLogger struct {
|
||||||
type Config struct {
|
producer *producer.Producer
|
||||||
|
callback *Callback
|
||||||
Project string `json:"project"`
|
Project string `json:"project"`
|
||||||
Endpoint string `json:"endpoint"`
|
Endpoint string `json:"endpoint"`
|
||||||
KeyID string `json:"key_id"`
|
KeyID string `json:"key_id"`
|
||||||
@ -28,157 +29,68 @@ type Config struct {
|
|||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
Level int `json:"level"`
|
Level int `json:"level"`
|
||||||
FlushWhen int `json:"flush_when"`
|
FlushWhen int `json:"flush_when"`
|
||||||
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// aliLSWriter implements LoggerInterface.
|
func (a *alilsLogger) Init(jsonconfig string) error {
|
||||||
// it writes messages in keep-live tcp connection.
|
|
||||||
type aliLSWriter struct {
|
|
||||||
store *LogStore
|
|
||||||
group []*LogGroup
|
|
||||||
withMap bool
|
|
||||||
groupMap map[string]*LogGroup
|
|
||||||
lock *sync.Mutex
|
|
||||||
Config
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewAliLS create a new Logger
|
err := json.Unmarshal([]byte(jsonconfig), a)
|
||||||
func NewAliLS() logs.Logger {
|
|
||||||
alils := new(aliLSWriter)
|
|
||||||
alils.Level = logs.LevelTrace
|
|
||||||
return alils
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init parse config and init struct
|
|
||||||
func (c *aliLSWriter) Init(jsonConfig string) (err error) {
|
|
||||||
|
|
||||||
json.Unmarshal([]byte(jsonConfig), c)
|
|
||||||
|
|
||||||
if c.FlushWhen > CacheSize {
|
|
||||||
c.FlushWhen = CacheSize
|
|
||||||
}
|
|
||||||
|
|
||||||
prj := &LogProject{
|
|
||||||
Name: c.Project,
|
|
||||||
Endpoint: c.Endpoint,
|
|
||||||
AccessKeyID: c.KeyID,
|
|
||||||
AccessKeySecret: c.KeySecret,
|
|
||||||
}
|
|
||||||
|
|
||||||
c.store, err = prj.GetLogStore(c.LogStore)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
producerConfig := producer.GetDefaultProducerConfig()
|
||||||
// Create default Log Group
|
producerConfig.Endpoint = a.Endpoint
|
||||||
c.group = append(c.group, &LogGroup{
|
producerConfig.AccessKeyID = a.KeyID
|
||||||
Topic: proto.String(""),
|
producerConfig.AccessKeySecret = a.KeySecret
|
||||||
Source: proto.String(c.Source),
|
producerConfig.LingerMs = 100
|
||||||
Logs: make([]*Log, 0, c.FlushWhen),
|
producerConfig.NoRetryStatusCodeList = []int{-1}
|
||||||
})
|
producerConfig.Retries = 2
|
||||||
|
producerConfig.AllowLogLevel = "error"
|
||||||
// Create other Log Group
|
producerConfig.MaxIoWorkerCount = int64(runtime.NumCPU())
|
||||||
c.groupMap = make(map[string]*LogGroup)
|
a.producer = producer.InitProducer(producerConfig)
|
||||||
for _, topic := range c.Topics {
|
a.callback = &Callback{}
|
||||||
|
a.producer.Start()
|
||||||
lg := &LogGroup{
|
a.Debug = os.Getenv("GRLOG_ALILS_DEBUG") == "on"
|
||||||
Topic: proto.String(topic),
|
|
||||||
Source: proto.String(c.Source),
|
|
||||||
Logs: make([]*Log, 0, c.FlushWhen),
|
|
||||||
}
|
|
||||||
|
|
||||||
c.group = append(c.group, lg)
|
|
||||||
c.groupMap[topic] = lg
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(c.group) == 1 {
|
|
||||||
c.withMap = false
|
|
||||||
} else {
|
|
||||||
c.withMap = true
|
|
||||||
}
|
|
||||||
|
|
||||||
c.lock = &sync.Mutex{}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteMsg write message in connection.
|
func (a *alilsLogger) WriteMsg(when time.Time, msg string, level int, label string, env string) error {
|
||||||
// if connection is down, try to re-connect.
|
|
||||||
func (c *aliLSWriter) WriteMsg(when time.Time, msg string, level int, lable string, env string) (err error) {
|
|
||||||
|
|
||||||
if level > c.Level {
|
vals := map[string]string{"msg": msg, "level": fmt.Sprintf("%d", level)}
|
||||||
return nil
|
vals["level_string"] = logs.GetLevelString(level)
|
||||||
|
vals["env"] = env
|
||||||
|
vals["label"] = label
|
||||||
|
vals["hostname"] = GetHostname()
|
||||||
|
vals["working_idr"] = Getwd()
|
||||||
|
vals["home_dir"] = GetUserHomename()
|
||||||
|
vals["hardware_addr"] = GetCurrentInterfaceHardwareAddr()
|
||||||
|
vals["client_addrs"] = GetCurrentInterfaceAddrs()
|
||||||
|
|
||||||
|
log := producer.GenerateLog(uint32(when.Unix()), vals)
|
||||||
|
|
||||||
|
if a.Debug {
|
||||||
|
for _, topic := range a.Topics {
|
||||||
|
if err := a.producer.SendLogWithCallBack(a.Project, a.LogStore, topic, a.Source, log, a.callback); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var topic string
|
|
||||||
var content string
|
|
||||||
var lg *LogGroup
|
|
||||||
if c.withMap {
|
|
||||||
|
|
||||||
// Topic,LogGroup
|
|
||||||
strs := strings.SplitN(msg, Delimiter, 2)
|
|
||||||
if len(strs) == 2 {
|
|
||||||
pos := strings.LastIndex(strs[0], " ")
|
|
||||||
topic = strs[0][pos+1 : len(strs[0])]
|
|
||||||
content = strs[0][0:pos] + strs[1]
|
|
||||||
lg = c.groupMap[topic]
|
|
||||||
}
|
|
||||||
|
|
||||||
// send to empty Topic
|
|
||||||
if lg == nil {
|
|
||||||
content = msg
|
|
||||||
lg = c.group[0]
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content = msg
|
for _, topic := range a.Topics {
|
||||||
lg = c.group[0]
|
if err := a.producer.SendLog(a.Project, a.LogStore, topic, a.Source, log); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c1 := &LogContent{
|
|
||||||
Key: proto.String("msg"),
|
|
||||||
Value: proto.String(content),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
l := &Log{
|
|
||||||
Time: proto.Uint32(uint32(when.Unix())),
|
|
||||||
Contents: []*LogContent{
|
|
||||||
c1,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.lock.Lock()
|
|
||||||
lg.Logs = append(lg.Logs, l)
|
|
||||||
c.lock.Unlock()
|
|
||||||
|
|
||||||
if len(lg.Logs) >= c.FlushWhen {
|
|
||||||
c.flush(lg)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush implementing method. empty.
|
func (a *alilsLogger) Destroy() {
|
||||||
func (c *aliLSWriter) Flush() {
|
a.producer.SafeClose()
|
||||||
|
a.producer.Close(300)
|
||||||
// flush all group
|
|
||||||
for _, lg := range c.group {
|
|
||||||
c.flush(lg)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy destroy connection writer and close tcp listener.
|
func (a *alilsLogger) Flush() {
|
||||||
func (c *aliLSWriter) Destroy() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *aliLSWriter) flush(lg *LogGroup) {
|
|
||||||
|
|
||||||
c.lock.Lock()
|
|
||||||
defer c.lock.Unlock()
|
|
||||||
err := c.store.PutLogs(lg)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
lg.Logs = make([]*Log, 0, c.FlushWhen)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
25
logs/alils/callback.go
Normal file
25
logs/alils/callback.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package alils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/aliyun/aliyun-log-go-sdk/producer"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Callback struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (callback *Callback) Success(result *producer.Result) {
|
||||||
|
attemptList := result.GetReservedAttempts()
|
||||||
|
for _, attempt := range attemptList {
|
||||||
|
fmt.Printf("alilog %+v \n", attempt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (callback *Callback) Fail(result *producer.Result) {
|
||||||
|
fmt.Println("IsSuccessful", result.IsSuccessful())
|
||||||
|
fmt.Println("GetErrorCode", result.GetErrorCode())
|
||||||
|
fmt.Println("GetErrorMessage", result.GetErrorMessage())
|
||||||
|
fmt.Println("GetReservedAttempts", result.GetReservedAttempts())
|
||||||
|
fmt.Println("GetRequestId", result.GetRequestId())
|
||||||
|
fmt.Println("GetTimeStampMs", result.GetTimeStampMs())
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
package alils
|
|
||||||
|
|
||||||
const (
|
|
||||||
version = "0.5.0" // SDK version
|
|
||||||
signatureMethod = "hmac-sha1" // Signature method
|
|
||||||
|
|
||||||
// OffsetNewest stands for the log head offset, i.e. the offset that will be
|
|
||||||
// assigned to the next message that will be produced to the shard.
|
|
||||||
OffsetNewest = "end"
|
|
||||||
// OffsetOldest stands for the oldest offset available on the logstore for a
|
|
||||||
// shard.
|
|
||||||
OffsetOldest = "begin"
|
|
||||||
)
|
|
1038
logs/alils/log.pb.go
1038
logs/alils/log.pb.go
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
|||||||
package alils
|
|
||||||
|
|
||||||
// InputDetail define log detail
|
|
||||||
type InputDetail struct {
|
|
||||||
LogType string `json:"logType"`
|
|
||||||
LogPath string `json:"logPath"`
|
|
||||||
FilePattern string `json:"filePattern"`
|
|
||||||
LocalStorage bool `json:"localStorage"`
|
|
||||||
TimeFormat string `json:"timeFormat"`
|
|
||||||
LogBeginRegex string `json:"logBeginRegex"`
|
|
||||||
Regex string `json:"regex"`
|
|
||||||
Keys []string `json:"key"`
|
|
||||||
FilterKeys []string `json:"filterKey"`
|
|
||||||
FilterRegex []string `json:"filterRegex"`
|
|
||||||
TopicFormat string `json:"topicFormat"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// OutputDetail define the output detail
|
|
||||||
type OutputDetail struct {
|
|
||||||
Endpoint string `json:"endpoint"`
|
|
||||||
LogStoreName string `json:"logstoreName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// LogConfig define Log Config
|
|
||||||
type LogConfig struct {
|
|
||||||
Name string `json:"configName"`
|
|
||||||
InputType string `json:"inputType"`
|
|
||||||
InputDetail InputDetail `json:"inputDetail"`
|
|
||||||
OutputType string `json:"outputType"`
|
|
||||||
OutputDetail OutputDetail `json:"outputDetail"`
|
|
||||||
|
|
||||||
CreateTime uint32
|
|
||||||
LastModifyTime uint32
|
|
||||||
|
|
||||||
project *LogProject
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAppliedMachineGroup returns applied machine group of this config.
|
|
||||||
func (c *LogConfig) GetAppliedMachineGroup(confName string) (groupNames []string, err error) {
|
|
||||||
groupNames, err = c.project.GetAppliedMachineGroups(c.Name)
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,819 +0,0 @@
|
|||||||
/*
|
|
||||||
Package alils implements the SDK(v0.5.0) of Simple Log Service(abbr. SLS).
|
|
||||||
|
|
||||||
For more description about SLS, please read this article:
|
|
||||||
http://gitlab.alibaba-inc.com/sls/doc.
|
|
||||||
*/
|
|
||||||
package alils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httputil"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Error message in SLS HTTP response.
|
|
||||||
type errorMessage struct {
|
|
||||||
Code string `json:"errorCode"`
|
|
||||||
Message string `json:"errorMessage"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// LogProject Define the Ali Project detail
|
|
||||||
type LogProject struct {
|
|
||||||
Name string // Project name
|
|
||||||
Endpoint string // IP or hostname of SLS endpoint
|
|
||||||
AccessKeyID string
|
|
||||||
AccessKeySecret string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewLogProject creates a new SLS project.
|
|
||||||
func NewLogProject(name, endpoint, AccessKeyID, accessKeySecret string) (p *LogProject, err error) {
|
|
||||||
p = &LogProject{
|
|
||||||
Name: name,
|
|
||||||
Endpoint: endpoint,
|
|
||||||
AccessKeyID: AccessKeyID,
|
|
||||||
AccessKeySecret: accessKeySecret,
|
|
||||||
}
|
|
||||||
return p, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListLogStore returns all logstore names of project p.
|
|
||||||
func (p *LogProject) ListLogStore() (storeNames []string, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/logstores")
|
|
||||||
r, err := request(p, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to list logstore")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
Count int
|
|
||||||
LogStores []string
|
|
||||||
}
|
|
||||||
body := &Body{}
|
|
||||||
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
storeNames = body.LogStores
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLogStore returns logstore according by logstore name.
|
|
||||||
func (p *LogProject) GetLogStore(name string) (s *LogStore, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "GET", "/logstores/"+name, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to get logstore")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
s = &LogStore{}
|
|
||||||
err = json.Unmarshal(buf, s)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
s.project = p
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateLogStore creates a new logstore in SLS,
|
|
||||||
// where name is logstore name,
|
|
||||||
// and ttl is time-to-live(in day) of logs,
|
|
||||||
// and shardCnt is the number of shards.
|
|
||||||
func (p *LogProject) CreateLogStore(name string, ttl, shardCnt int) (err error) {
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
Name string `json:"logstoreName"`
|
|
||||||
TTL int `json:"ttl"`
|
|
||||||
ShardCount int `json:"shardCount"`
|
|
||||||
}
|
|
||||||
|
|
||||||
store := &Body{
|
|
||||||
Name: name,
|
|
||||||
TTL: ttl,
|
|
||||||
ShardCount: shardCnt,
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := json.Marshal(store)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept-Encoding": "deflate", // TODO: support lz4
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "POST", "/logstores", h, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to create logstore")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteLogStore deletes a logstore according by logstore name.
|
|
||||||
func (p *LogProject) DeleteLogStore(name string) (err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "DELETE", "/logstores/"+name, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to delete logstore")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateLogStore updates a logstore according by logstore name,
|
|
||||||
// obviously we can't modify the logstore name itself.
|
|
||||||
func (p *LogProject) UpdateLogStore(name string, ttl, shardCnt int) (err error) {
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
Name string `json:"logstoreName"`
|
|
||||||
TTL int `json:"ttl"`
|
|
||||||
ShardCount int `json:"shardCount"`
|
|
||||||
}
|
|
||||||
|
|
||||||
store := &Body{
|
|
||||||
Name: name,
|
|
||||||
TTL: ttl,
|
|
||||||
ShardCount: shardCnt,
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := json.Marshal(store)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept-Encoding": "deflate", // TODO: support lz4
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "PUT", "/logstores", h, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to update logstore")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListMachineGroup returns machine group name list and the total number of machine groups.
|
|
||||||
// The offset starts from 0 and the size is the max number of machine groups could be returned.
|
|
||||||
func (p *LogProject) ListMachineGroup(offset, size int) (m []string, total int, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
if size <= 0 {
|
|
||||||
size = 500
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/machinegroups?offset=%v&size=%v", offset, size)
|
|
||||||
r, err := request(p, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to list machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
MachineGroups []string
|
|
||||||
Count int
|
|
||||||
Total int
|
|
||||||
}
|
|
||||||
body := &Body{}
|
|
||||||
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
m = body.MachineGroups
|
|
||||||
total = body.Total
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetMachineGroup retruns machine group according by machine group name.
|
|
||||||
func (p *LogProject) GetMachineGroup(name string) (m *MachineGroup, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "GET", "/machinegroups/"+name, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to get machine group:%v", name)
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
m = &MachineGroup{}
|
|
||||||
err = json.Unmarshal(buf, m)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
m.project = p
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateMachineGroup creates a new machine group in SLS.
|
|
||||||
func (p *LogProject) CreateMachineGroup(m *MachineGroup) (err error) {
|
|
||||||
|
|
||||||
body, err := json.Marshal(m)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept-Encoding": "deflate", // TODO: support lz4
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "POST", "/machinegroups", h, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to create machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateMachineGroup updates a machine group.
|
|
||||||
func (p *LogProject) UpdateMachineGroup(m *MachineGroup) (err error) {
|
|
||||||
|
|
||||||
body, err := json.Marshal(m)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept-Encoding": "deflate", // TODO: support lz4
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "PUT", "/machinegroups/"+m.Name, h, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to update machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteMachineGroup deletes machine group according machine group name.
|
|
||||||
func (p *LogProject) DeleteMachineGroup(name string) (err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "DELETE", "/machinegroups/"+name, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to delete machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListConfig returns config names list and the total number of configs.
|
|
||||||
// The offset starts from 0 and the size is the max number of configs could be returned.
|
|
||||||
func (p *LogProject) ListConfig(offset, size int) (cfgNames []string, total int, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
if size <= 0 {
|
|
||||||
size = 100
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/configs?offset=%v&size=%v", offset, size)
|
|
||||||
r, err := request(p, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to delete machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
Total int
|
|
||||||
Configs []string
|
|
||||||
}
|
|
||||||
body := &Body{}
|
|
||||||
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
cfgNames = body.Configs
|
|
||||||
total = body.Total
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetConfig returns config according by config name.
|
|
||||||
func (p *LogProject) GetConfig(name string) (c *LogConfig, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "GET", "/configs/"+name, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to delete config")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
c = &LogConfig{}
|
|
||||||
err = json.Unmarshal(buf, c)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.project = p
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateConfig updates a config.
|
|
||||||
func (p *LogProject) UpdateConfig(c *LogConfig) (err error) {
|
|
||||||
|
|
||||||
body, err := json.Marshal(c)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept-Encoding": "deflate", // TODO: support lz4
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "PUT", "/configs/"+c.Name, h, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to update config")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateConfig creates a new config in SLS.
|
|
||||||
func (p *LogProject) CreateConfig(c *LogConfig) (err error) {
|
|
||||||
|
|
||||||
body, err := json.Marshal(c)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept-Encoding": "deflate", // TODO: support lz4
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "POST", "/configs", h, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to update config")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteConfig deletes a config according by config name.
|
|
||||||
func (p *LogProject) DeleteConfig(name string) (err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := request(p, "DELETE", "/configs/"+name, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(body, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to delete config")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAppliedMachineGroups returns applied machine group names list according config name.
|
|
||||||
func (p *LogProject) GetAppliedMachineGroups(confName string) (groupNames []string, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/configs/%v/machinegroups", confName)
|
|
||||||
r, err := request(p, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to get applied machine groups")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
Count int
|
|
||||||
Machinegroups []string
|
|
||||||
}
|
|
||||||
|
|
||||||
body := &Body{}
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
groupNames = body.Machinegroups
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAppliedConfigs returns applied config names list according machine group name groupName.
|
|
||||||
func (p *LogProject) GetAppliedConfigs(groupName string) (confNames []string, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/machinegroups/%v/configs", groupName)
|
|
||||||
r, err := request(p, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to applied configs")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type Cfg struct {
|
|
||||||
Count int `json:"count"`
|
|
||||||
Configs []string `json:"configs"`
|
|
||||||
}
|
|
||||||
|
|
||||||
body := &Cfg{}
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
confNames = body.Configs
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ApplyConfigToMachineGroup applies config to machine group.
|
|
||||||
func (p *LogProject) ApplyConfigToMachineGroup(confName, groupName string) (err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/machinegroups/%v/configs/%v", groupName, confName)
|
|
||||||
r, err := request(p, "PUT", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to apply config to machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveConfigFromMachineGroup removes config from machine group.
|
|
||||||
func (p *LogProject) RemoveConfigFromMachineGroup(confName, groupName string) (err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/machinegroups/%v/configs/%v", groupName, confName)
|
|
||||||
r, err := request(p, "DELETE", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to remove config from machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Printf("%s\n", dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,271 +0,0 @@
|
|||||||
package alils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httputil"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
lz4 "github.com/cloudflare/golz4"
|
|
||||||
"github.com/gogo/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// LogStore Store the logs
|
|
||||||
type LogStore struct {
|
|
||||||
Name string `json:"logstoreName"`
|
|
||||||
TTL int
|
|
||||||
ShardCount int
|
|
||||||
|
|
||||||
CreateTime uint32
|
|
||||||
LastModifyTime uint32
|
|
||||||
|
|
||||||
project *LogProject
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shard define the Log Shard
|
|
||||||
type Shard struct {
|
|
||||||
ShardID int `json:"shardID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListShards returns shard id list of this logstore.
|
|
||||||
func (s *LogStore) ListShards() (shardIDs []int, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/logstores/%v/shards", s.Name)
|
|
||||||
r, err := request(s.project, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to list logstore")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Println(dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var shards []*Shard
|
|
||||||
err = json.Unmarshal(buf, &shards)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, v := range shards {
|
|
||||||
shardIDs = append(shardIDs, v.ShardID)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutLogs put logs into logstore.
|
|
||||||
// The callers should transform user logs into LogGroup.
|
|
||||||
func (s *LogStore) PutLogs(lg *LogGroup) (err error) {
|
|
||||||
body, err := proto.Marshal(lg)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compresse body with lz4
|
|
||||||
out := make([]byte, lz4.CompressBound(body))
|
|
||||||
n, err := lz4.Compress(body, out)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-compresstype": "lz4",
|
|
||||||
"x-sls-bodyrawsize": fmt.Sprintf("%v", len(body)),
|
|
||||||
"Content-Type": "application/x-protobuf",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/logstores/%v", s.Name)
|
|
||||||
r, err := request(s.project, "POST", uri, h, out[:n])
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to put logs")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Println(dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCursor gets log cursor of one shard specified by shardID.
|
|
||||||
// The from can be in three form: a) unix timestamp in seccond, b) "begin", c) "end".
|
|
||||||
// For more detail please read: http://gitlab.alibaba-inc.com/sls/doc/blob/master/api/shard.md#logstore
|
|
||||||
func (s *LogStore) GetCursor(shardID int, from string) (cursor string, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/logstores/%v/shards/%v?type=cursor&from=%v",
|
|
||||||
s.Name, shardID, from)
|
|
||||||
|
|
||||||
r, err := request(s.project, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to get cursor")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Println(dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type Body struct {
|
|
||||||
Cursor string
|
|
||||||
}
|
|
||||||
body := &Body{}
|
|
||||||
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
cursor = body.Cursor
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLogsBytes gets logs binary data from shard specified by shardID according cursor.
|
|
||||||
// The logGroupMaxCount is the max number of logGroup could be returned.
|
|
||||||
// The nextCursor is the next curosr can be used to read logs at next time.
|
|
||||||
func (s *LogStore) GetLogsBytes(shardID int, cursor string,
|
|
||||||
logGroupMaxCount int) (out []byte, nextCursor string, err error) {
|
|
||||||
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
"Accept": "application/x-protobuf",
|
|
||||||
"Accept-Encoding": "lz4",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/logstores/%v/shards/%v?type=logs&cursor=%v&count=%v",
|
|
||||||
s.Name, shardID, cursor, logGroupMaxCount)
|
|
||||||
|
|
||||||
r, err := request(s.project, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to get cursor")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Println(dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
v, ok := r.Header["X-Sls-Compresstype"]
|
|
||||||
if !ok || len(v) == 0 {
|
|
||||||
err = fmt.Errorf("can't find 'x-sls-compresstype' header")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if v[0] != "lz4" {
|
|
||||||
err = fmt.Errorf("unexpected compress type:%v", v[0])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
v, ok = r.Header["X-Sls-Cursor"]
|
|
||||||
if !ok || len(v) == 0 {
|
|
||||||
err = fmt.Errorf("can't find 'x-sls-cursor' header")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
nextCursor = v[0]
|
|
||||||
|
|
||||||
v, ok = r.Header["X-Sls-Bodyrawsize"]
|
|
||||||
if !ok || len(v) == 0 {
|
|
||||||
err = fmt.Errorf("can't find 'x-sls-bodyrawsize' header")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bodyRawSize, err := strconv.Atoi(v[0])
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
out = make([]byte, bodyRawSize)
|
|
||||||
err = lz4.Uncompress(buf, out)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// LogsBytesDecode decodes logs binary data retruned by GetLogsBytes API
|
|
||||||
func LogsBytesDecode(data []byte) (gl *LogGroupList, err error) {
|
|
||||||
|
|
||||||
gl = &LogGroupList{}
|
|
||||||
err = proto.Unmarshal(data, gl)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLogs gets logs from shard specified by shardID according cursor.
|
|
||||||
// The logGroupMaxCount is the max number of logGroup could be returned.
|
|
||||||
// The nextCursor is the next curosr can be used to read logs at next time.
|
|
||||||
func (s *LogStore) GetLogs(shardID int, cursor string,
|
|
||||||
logGroupMaxCount int) (gl *LogGroupList, nextCursor string, err error) {
|
|
||||||
|
|
||||||
out, nextCursor, err := s.GetLogsBytes(shardID, cursor, logGroupMaxCount)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
gl, err = LogsBytesDecode(out)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package alils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httputil"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MachineGroupAttribute define the Attribute
|
|
||||||
type MachineGroupAttribute struct {
|
|
||||||
ExternalName string `json:"externalName"`
|
|
||||||
TopicName string `json:"groupTopic"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// MachineGroup define the machine Group
|
|
||||||
type MachineGroup struct {
|
|
||||||
Name string `json:"groupName"`
|
|
||||||
Type string `json:"groupType"`
|
|
||||||
MachineIDType string `json:"machineIdentifyType"`
|
|
||||||
MachineIDList []string `json:"machineList"`
|
|
||||||
|
|
||||||
Attribute MachineGroupAttribute `json:"groupAttribute"`
|
|
||||||
|
|
||||||
CreateTime uint32
|
|
||||||
LastModifyTime uint32
|
|
||||||
|
|
||||||
project *LogProject
|
|
||||||
}
|
|
||||||
|
|
||||||
// Machine define the Machine
|
|
||||||
type Machine struct {
|
|
||||||
IP string
|
|
||||||
UniqueID string `json:"machine-uniqueid"`
|
|
||||||
UserdefinedID string `json:"userdefined-id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// MachineList define the Machine List
|
|
||||||
type MachineList struct {
|
|
||||||
Total int
|
|
||||||
Machines []*Machine
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListMachines returns machine list of this machine group.
|
|
||||||
func (m *MachineGroup) ListMachines() (ms []*Machine, total int, err error) {
|
|
||||||
h := map[string]string{
|
|
||||||
"x-sls-bodyrawsize": "0",
|
|
||||||
}
|
|
||||||
|
|
||||||
uri := fmt.Sprintf("/machinegroups/%v/machines", m.Name)
|
|
||||||
r, err := request(m.project, "GET", uri, h, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.StatusCode != http.StatusOK {
|
|
||||||
errMsg := &errorMessage{}
|
|
||||||
err = json.Unmarshal(buf, errMsg)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("failed to remove config from machine group")
|
|
||||||
dump, _ := httputil.DumpResponse(r, true)
|
|
||||||
fmt.Println(dump)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v:%v", errMsg.Code, errMsg.Message)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body := &MachineList{}
|
|
||||||
err = json.Unmarshal(buf, body)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ms = body.Machines
|
|
||||||
total = body.Total
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAppliedConfigs returns applied configs of this machine group.
|
|
||||||
func (m *MachineGroup) GetAppliedConfigs() (confNames []string, err error) {
|
|
||||||
confNames, err = m.project.GetAppliedConfigs(m.Name)
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
package alils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"crypto/md5"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// request sends a request to SLS.
|
|
||||||
func request(project *LogProject, method, uri string, headers map[string]string,
|
|
||||||
body []byte) (resp *http.Response, err error) {
|
|
||||||
|
|
||||||
// The caller should provide 'x-sls-bodyrawsize' header
|
|
||||||
if _, ok := headers["x-sls-bodyrawsize"]; !ok {
|
|
||||||
err = fmt.Errorf("Can't find 'x-sls-bodyrawsize' header")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// SLS public request headers
|
|
||||||
headers["Host"] = project.Name + "." + project.Endpoint
|
|
||||||
headers["Date"] = nowRFC1123()
|
|
||||||
headers["x-sls-apiversion"] = version
|
|
||||||
headers["x-sls-signaturemethod"] = signatureMethod
|
|
||||||
if body != nil {
|
|
||||||
bodyMD5 := fmt.Sprintf("%X", md5.Sum(body))
|
|
||||||
headers["Content-MD5"] = bodyMD5
|
|
||||||
|
|
||||||
if _, ok := headers["Content-Type"]; !ok {
|
|
||||||
err = fmt.Errorf("Can't find 'Content-Type' header")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calc Authorization
|
|
||||||
// Authorization = "SLS <AccessKeyID>:<Signature>"
|
|
||||||
digest, err := signature(project, method, uri, headers)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
auth := fmt.Sprintf("SLS %v:%v", project.AccessKeyID, digest)
|
|
||||||
headers["Authorization"] = auth
|
|
||||||
|
|
||||||
// Initialize http request
|
|
||||||
reader := bytes.NewReader(body)
|
|
||||||
urlStr := fmt.Sprintf("http://%v.%v%v", project.Name, project.Endpoint, uri)
|
|
||||||
req, err := http.NewRequest(method, urlStr, reader)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for k, v := range headers {
|
|
||||||
req.Header.Add(k, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get ready to do request
|
|
||||||
resp, err = http.DefaultClient.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
package alils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/hmac"
|
|
||||||
"crypto/sha1"
|
|
||||||
"encoding/base64"
|
|
||||||
"fmt"
|
|
||||||
"net/url"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GMT location
|
|
||||||
var gmtLoc = time.FixedZone("GMT", 0)
|
|
||||||
|
|
||||||
// NowRFC1123 returns now time in RFC1123 format with GMT timezone,
|
|
||||||
// eg. "Mon, 02 Jan 2006 15:04:05 GMT".
|
|
||||||
func nowRFC1123() string {
|
|
||||||
return time.Now().In(gmtLoc).Format(time.RFC1123)
|
|
||||||
}
|
|
||||||
|
|
||||||
// signature calculates a request's signature digest.
|
|
||||||
func signature(project *LogProject, method, uri string,
|
|
||||||
headers map[string]string) (digest string, err error) {
|
|
||||||
var contentMD5, contentType, date, canoHeaders, canoResource string
|
|
||||||
var slsHeaderKeys sort.StringSlice
|
|
||||||
|
|
||||||
// SignString = VERB + "\n"
|
|
||||||
// + CONTENT-MD5 + "\n"
|
|
||||||
// + CONTENT-TYPE + "\n"
|
|
||||||
// + DATE + "\n"
|
|
||||||
// + CanonicalizedSLSHeaders + "\n"
|
|
||||||
// + CanonicalizedResource
|
|
||||||
|
|
||||||
if val, ok := headers["Content-MD5"]; ok {
|
|
||||||
contentMD5 = val
|
|
||||||
}
|
|
||||||
|
|
||||||
if val, ok := headers["Content-Type"]; ok {
|
|
||||||
contentType = val
|
|
||||||
}
|
|
||||||
|
|
||||||
date, ok := headers["Date"]
|
|
||||||
if !ok {
|
|
||||||
err = fmt.Errorf("Can't find 'Date' header")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calc CanonicalizedSLSHeaders
|
|
||||||
slsHeaders := make(map[string]string, len(headers))
|
|
||||||
for k, v := range headers {
|
|
||||||
l := strings.TrimSpace(strings.ToLower(k))
|
|
||||||
if strings.HasPrefix(l, "x-sls-") {
|
|
||||||
slsHeaders[l] = strings.TrimSpace(v)
|
|
||||||
slsHeaderKeys = append(slsHeaderKeys, l)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Sort(slsHeaderKeys)
|
|
||||||
for i, k := range slsHeaderKeys {
|
|
||||||
canoHeaders += k + ":" + slsHeaders[k]
|
|
||||||
if i+1 < len(slsHeaderKeys) {
|
|
||||||
canoHeaders += "\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calc CanonicalizedResource
|
|
||||||
u, err := url.Parse(uri)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
canoResource += url.QueryEscape(u.Path)
|
|
||||||
if u.RawQuery != "" {
|
|
||||||
var keys sort.StringSlice
|
|
||||||
|
|
||||||
vals := u.Query()
|
|
||||||
for k := range vals {
|
|
||||||
keys = append(keys, k)
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Sort(keys)
|
|
||||||
canoResource += "?"
|
|
||||||
for i, k := range keys {
|
|
||||||
if i > 0 {
|
|
||||||
canoResource += "&"
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, v := range vals[k] {
|
|
||||||
canoResource += k + "=" + v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
signStr := method + "\n" +
|
|
||||||
contentMD5 + "\n" +
|
|
||||||
contentType + "\n" +
|
|
||||||
date + "\n" +
|
|
||||||
canoHeaders + "\n" +
|
|
||||||
canoResource
|
|
||||||
|
|
||||||
// Signature = base64(hmac-sha1(UTF8-Encoding-Of(SignString),AccessKeySecret))
|
|
||||||
mac := hmac.New(sha1.New, []byte(project.AccessKeySecret))
|
|
||||||
_, err = mac.Write([]byte(signStr))
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
digest = base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
|
||||||
return
|
|
||||||
}
|
|
47
logs/alils/sys.go
Normal file
47
logs/alils/sys.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package alils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetCurrentInterface() *net.Interface {
|
||||||
|
if inter, err := net.InterfaceByName("eth0"); err == nil {
|
||||||
|
return inter
|
||||||
|
} else if inter, err := net.InterfaceByName("en0"); err == nil {
|
||||||
|
return inter
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCurrentInterfaceHardwareAddr() string {
|
||||||
|
if inter := GetCurrentInterface(); inter != nil {
|
||||||
|
return fmt.Sprintf("%s", inter.HardwareAddr)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCurrentInterfaceAddrs() string {
|
||||||
|
if inter := GetCurrentInterface(); inter != nil {
|
||||||
|
if addrs, err := inter.Addrs(); err == nil {
|
||||||
|
return fmt.Sprintf("%s", addrs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetHostname() string {
|
||||||
|
hostname, _ := os.Hostname()
|
||||||
|
return hostname
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUserHomename() string {
|
||||||
|
homedir, _ := os.UserHomeDir()
|
||||||
|
return homedir
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getwd() string {
|
||||||
|
wd, _ := os.Getwd()
|
||||||
|
return wd
|
||||||
|
}
|
@ -10,7 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golib.gaore.com/GaoreGo/goes"
|
"golib.gaore.com/GaoreGo/goes"
|
||||||
"golib.gaore.com/GaoreGo/grlogs/logs"
|
"golib.gaore.com/GaoreGo/haiwai-grlogs/v2/logs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewES return a LoggerInterface
|
// NewES return a LoggerInterface
|
||||||
@ -80,7 +80,7 @@ func (el *esLogger) WriteMsg(when time.Time, msg string, level int, lable string
|
|||||||
vals["hostname"] = GetHostname()
|
vals["hostname"] = GetHostname()
|
||||||
vals["working_idr"] = Getwd()
|
vals["working_idr"] = Getwd()
|
||||||
vals["home_dir"] = GetUserHomename()
|
vals["home_dir"] = GetUserHomename()
|
||||||
vals["hardware_addr"] = GetCurrentInterface().HardwareAddr
|
vals["hardware_addr"] = GetCurrentInterfaceHardwareAddr()
|
||||||
vals["client_addrs"] = GetCurrentInterfaceAddrs()
|
vals["client_addrs"] = GetCurrentInterfaceAddrs()
|
||||||
|
|
||||||
if el.IndexName == "" {
|
if el.IndexName == "" {
|
||||||
@ -89,7 +89,7 @@ func (el *esLogger) WriteMsg(when time.Time, msg string, level int, lable string
|
|||||||
|
|
||||||
d := goes.Document{
|
d := goes.Document{
|
||||||
Index: fmt.Sprintf("%s-%04d.%02d.%02d", el.IndexName, when.Year(), when.Month(), when.Day()),
|
Index: fmt.Sprintf("%s-%04d.%02d.%02d", el.IndexName, when.Year(), when.Month(), when.Day()),
|
||||||
Type: "logs",
|
Type: "_doc",
|
||||||
Fields: vals,
|
Fields: vals,
|
||||||
}
|
}
|
||||||
_, err := el.Index(d, nil)
|
_, err := el.Index(d, nil)
|
||||||
|
@ -15,6 +15,13 @@ func GetCurrentInterface() *net.Interface {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCurrentInterfaceHardwareAddr() string {
|
||||||
|
if inter := GetCurrentInterface(); inter != nil {
|
||||||
|
return fmt.Sprintf("%s", inter.HardwareAddr)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func GetCurrentInterfaceAddrs() string {
|
func GetCurrentInterfaceAddrs() string {
|
||||||
if inter := GetCurrentInterface(); inter != nil {
|
if inter := GetCurrentInterface(); inter != nil {
|
||||||
if addrs, err := inter.Addrs(); err == nil {
|
if addrs, err := inter.Addrs(); err == nil {
|
||||||
|
@ -81,7 +81,7 @@ func newFileWriter() Logger {
|
|||||||
Rotate: true,
|
Rotate: true,
|
||||||
RotatePerm: "0440",
|
RotatePerm: "0440",
|
||||||
Level: LevelTrace,
|
Level: LevelTrace,
|
||||||
Perm: "0660",
|
Perm: "0755",
|
||||||
MaxLines: 10000000,
|
MaxLines: 10000000,
|
||||||
MaxFiles: 999,
|
MaxFiles: 999,
|
||||||
MaxSize: 1 << 28,
|
MaxSize: 1 << 28,
|
||||||
@ -91,6 +91,7 @@ func newFileWriter() Logger {
|
|||||||
|
|
||||||
// Init file logger with json config.
|
// Init file logger with json config.
|
||||||
// jsonConfig like:
|
// jsonConfig like:
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// "filename":"logs/beego.log",
|
// "filename":"logs/beego.log",
|
||||||
// "maxLines":10000,
|
// "maxLines":10000,
|
||||||
|
@ -281,7 +281,7 @@ func testFileRotate(t *testing.T, fn1, fn2 string, daily, hourly bool) {
|
|||||||
fw.hourlyOpenDate = fw.hourlyOpenTime.Day()
|
fw.hourlyOpenDate = fw.hourlyOpenTime.Day()
|
||||||
}
|
}
|
||||||
|
|
||||||
fw.WriteMsg(time.Now(), "this is a msg for test", LevelDebug)
|
fw.WriteMsg(time.Now(), "this is a msg for test", LevelDebug, "", "dev")
|
||||||
|
|
||||||
for _, file := range []string{fn1, fn2} {
|
for _, file := range []string{fn1, fn2} {
|
||||||
_, err := os.Stat(file)
|
_, err := os.Stat(file)
|
||||||
|
@ -122,7 +122,7 @@ type BeeLogger struct {
|
|||||||
signalChan chan string
|
signalChan chan string
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
outputs []*nameLogger
|
outputs []*nameLogger
|
||||||
Lable string
|
Label string
|
||||||
Env string
|
Env string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ func (bl *BeeLogger) DelLogger(adapterName string) error {
|
|||||||
|
|
||||||
func (bl *BeeLogger) writeToLoggers(when time.Time, msg string, level int) {
|
func (bl *BeeLogger) writeToLoggers(when time.Time, msg string, level int) {
|
||||||
for _, l := range bl.outputs {
|
for _, l := range bl.outputs {
|
||||||
err := l.WriteMsg(when, msg, level, bl.Lable, bl.Env)
|
err := l.WriteMsg(when, msg, level, bl.Label, bl.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "unable to WriteMsg to adapter:%v,error:%v\n", l.name, err)
|
fmt.Fprintf(os.Stderr, "unable to WriteMsg to adapter:%v,error:%v\n", l.name, err)
|
||||||
}
|
}
|
||||||
|
12
options.go
12
options.go
@ -4,6 +4,11 @@ type Level int
|
|||||||
|
|
||||||
type Adapter string
|
type Adapter string
|
||||||
|
|
||||||
|
type AdapterTupple struct {
|
||||||
|
Level Level
|
||||||
|
Adapter Adapter
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_ Level = iota
|
_ Level = iota
|
||||||
LevelNone Level = iota
|
LevelNone Level = iota
|
||||||
@ -21,4 +26,11 @@ const (
|
|||||||
AdapterConsole Adapter = "console"
|
AdapterConsole Adapter = "console"
|
||||||
AdapterSocket Adapter = "socket"
|
AdapterSocket Adapter = "socket"
|
||||||
AdapterElasticSearch Adapter = "es"
|
AdapterElasticSearch Adapter = "es"
|
||||||
|
AdapterAliLs Adapter = "alils"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DEV = "dev"
|
||||||
|
GRAY = "gray"
|
||||||
|
PROD = "prod"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user