Configure collector push address (#296)

* "配置化collector推送地址"

* "配置化collector推送地址"

Co-authored-by: 孙宇 <suny129@chinaunicom.cn>
This commit is contained in:
sunyu 2020-09-16 20:33:00 +08:00 committed by GitHub
parent fb6e789909
commit bc884175be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -27,8 +27,8 @@ func Init(prefix string, addr ...string) {
} else if file.IsExist(path.Join(runner.Cwd, "etc", "address.yml")) { } else if file.IsExist(path.Join(runner.Cwd, "etc", "address.yml")) {
//address.yml 存在,则使用配置文件的地址 //address.yml 存在,则使用配置文件的地址
port := address.GetHTTPPort("collector") newAddr := address.GetHTTPAddresses("collector")
PushUrl = fmt.Sprintf("http://127.0.0.1:%d/api/collector/push", port) PushUrl = fmt.Sprintf("http://%s/api/collector/push", newAddr[0])
} }
Counter = NewCounter(prefix) Counter = NewCounter(prefix)