8000 (Bugfix):Add mIntervals to adjust the collection interval when more collector is needed by wardenjohn · Pull Request #2206 · alibaba/loongcollector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

(Bugfix):Add mIntervals to adjust the collection interval when more collector is needed #2206

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

wardenjohn
Copy link
Contributor
@wardenjohn wardenjohn commented May 9, 2025

背景

在尝试对host_monitor进行新collector增加的时候,会发现新collector注册以后,运行collector以后会出现程序运行卡住,cpu占用较高的情况

原因

原始函数在进行UpdateCollector的时候,只传入了一个mInterval,导致了在多个collector的时候,只有一个mInterval传入,其他mInterval默认为0,无法运行

解决方案

为了适配可以灵活添加使能Collector,修改配置的层级结构,不同的Collector下面分别有其自身的采样间隔以及使能开关。
然后新增mIntervals vector,用于给对应的sName Collector的采样间隔,使其正常运行

@CLAassistant
Copy link
CLAassistant commented May 9, 2025

CLA assistant check
All committers have signed the CLA.

@wardenjohn wardenjohn force-pushed the fix_collector_stuck branch 2 times, most recently from 9e1a281 to 0825d23 Compare May 9, 2025 06:02
@wardenjohn wardenjohn changed the title (Bugfix):Add mIntervals to adjust the collection interval when more c… (Bugfix):Add mIntervals to adjust the collection interval when more collector is needed May 9, 2025
@wardenjohn wardenjohn force-pushed the fix_collector_stuck branch 7 times, most recently from 9728e53 to b98f1d1 Compare May 13, 2025 11:04
mContext->GetRegion());
uint32_t cpuInterval = mInterval;
if (config.isMember("CPU")) {
const Json::Value cpuConfig = config.get("CPU", Json::Value(Json::objectValue));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用这个方法来提取吧 GetOptionalMapParam

mContext->GetRegion());
uint32_t cpuInterval = mInterval;
if (config.isMember("CPU")) {
const Json::Value cpuConfig = config.get("CPU", Json::Value(Json::objectValue));
Copy link
Collaborator
@messixukejia messixukejia May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

每个场景单独控制的必要性需要综合评估下 @Abingcbc
1、太复杂了
2、对基础云监控的影响

@wardenjohn wardenjohn force-pushed the fix_collector_stuck branch from b98f1d1 to b19e683 Compare May 16, 2025 03:46
…interval when more collector is needed

When a new collector is registerd, missing interval will make loongcollector stuck.
Adding a new vector to store the mInterval of each collector, to make sure
each collector have its own interval instead of 0, making loongcollector stuck.
@wardenjohn wardenjohn force-pushed the fix_collector_stuck branch from b19e683 to 958e8cd Compare May 16, 2025 07:36
@Abingcbc Abingcbc merged commit 53cb95d into alibaba:main May 16, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0