-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 支持主配置变更重加载 #109
base: master
Are you sure you want to change the base?
feat: 支持主配置变更重加载 #109
Conversation
"fmt" | ||
"github.com/TencentBlueKing/bkunifylogbeat/utils" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意代码格式化。
@@ -118,6 +123,7 @@ func (bt *LogBeat) Run() error { | |||
} | |||
|
|||
reloadTicker := time.NewTicker(10 * time.Second) | |||
diffTaskTicker := time.NewTicker(60 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 ticker 也需要 defer stop
@@ -130,6 +136,11 @@ func (bt *LogBeat) Run() error { | |||
bt.Reload(config) | |||
} | |||
} | |||
// 处理采集器主配置是否变更,变更则发送重加载信号 | |||
case <-diffTaskTicker.C: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议按需开启,而不是成为一种默认行为。
if err != nil { | ||
return err | ||
} | ||
if !rawConfig.HasField("bkunifylogbeat") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个建议可以写成常量。
No description provided.