mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
refactor(client): if subdir is empty from cfg file, use cfg from option.
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
b57d898709
commit
1e8ffbeb73
@ -541,6 +541,11 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.GetString(exporter.ConfigKeySubDir) == "" {
|
||||
cfg.SetString(exporter.ConfigKeySubDir, opt.SubDir)
|
||||
syslog.Printf("config subdir empty, use cfg from mnt, subdir %s", opt.SubDir)
|
||||
}
|
||||
|
||||
exporter.Init(ModuleName, cfg)
|
||||
exporter.RegistConsul(super.ClusterName(), ModuleName, cfg)
|
||||
metric := exporter.NewVersionMetrics(ModuleName)
|
||||
|
||||
@ -44,6 +44,7 @@ const (
|
||||
ConfigKeyEnablePid = "enablePid" // enable report partition id
|
||||
ConfigKeyPushAddr = "pushAddr" // enable push data to gateway
|
||||
ChSize = 1024 * 10 // collect chan size
|
||||
ConfigKeySubDir = "subdir"
|
||||
|
||||
// monitor label name
|
||||
Vol = "vol"
|
||||
@ -161,12 +162,12 @@ func RegistConsul(cluster string, role string, cfg *config.Config) {
|
||||
return
|
||||
}
|
||||
|
||||
rawmnt := cfg.GetString("subdir")
|
||||
rawmnt := cfg.GetString(ConfigKeySubDir)
|
||||
if rawmnt == "" {
|
||||
rawmnt = "/"
|
||||
}
|
||||
mountPoint, _ := filepath.Abs(rawmnt)
|
||||
log.LogInfof("RegistConsul:%v", enablePush)
|
||||
log.LogWarnf("RegistConsul:%v, subdir %s", enablePush, mountPoint)
|
||||
if enablePush {
|
||||
log.LogWarnf("[RegisterConsul] use auto push data strategy, not register consul")
|
||||
autoPush(pushAddr, role, cluster, host, mountPoint)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user