提交 408b6494 编写于 作者: 7 710leo

refactor: stats use address.yml

上级 2b30d8e0
......@@ -21,14 +21,14 @@ var (
)
func Init(prefix string, addr ...string) {
if len(addr) > 0 && addr[0] != "" {
//如果配置了 addr,使用 addr 参数
PushUrl = addr[0]
if file.IsExist(path.Join(runner.Cwd, "etc", "address.yml")) {
//address.yml 存在,使用配置文件的地址
} else if file.IsExist(path.Join(runner.Cwd, "etc", "address.yml")) {
//address.yml 存在,使用配置文件的地址
port := address.GetHTTPPort("collector")
PushUrl = fmt.Sprintf("http://127.0.0.1:%d/api/collector/push", port)
} else if len(addr) > 0 && addr[0] != "" {
// address.yml 不存在,使用 addr 参数
PushUrl = addr[0]
}
Counter = NewCounter(prefix)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册