-
Notifications
You must be signed in to change notification settings - Fork 418
feat: add instance labels into host monitor metrics #2226
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
Conversation
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.
Pull Request Overview
This PR adds functionality to tag host monitor metrics with instance and user labels for the enterprise version and with a host IP label for the open-source version.
- Added a new method AddHostLabels in HostMonitorInputRunner to assign labels.
- Introduced new constants for default tag names in both enterprise and open-source modes.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
core/host_monitor/HostMonitorInputRunner.h | Added declaration of AddHostLabels method |
core/host_monitor/HostMonitorInputRunner.cpp | Calls AddHostLabels to tag metrics and implements label assignment |
core/host_monitor/Constants.h | Added declaration of new label constants under conditional macros |
core/host_monitor/Constants.cpp | Defined the new label constants for enterprise and open-source builds |
@@ -197,4 +209,30 @@ void HostMonitorInputRunner::PushNextTimerEvent(const std::chrono::steady_clock: | |||
Timer::GetInstance()->PushEvent(std::move(event)); | |||
} | |||
|
|||
void HostMonitorInputRunner::AddHostLabels(PipelineEventGroup& group) { | |||
#ifdef __ENTERPRISE__ | |||
auto userID = group.GetSourceBuffer()->CopyString(EnterpriseConfigProvider::GetInstance()->GetAliuidSet()); |
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.
允许多个uid?
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.
应该取ECS Meta中的user id
* feat: add instance labels into host monitor metrics
* feat: add instance labels into host monitor metrics
商业版主机监控指标默认添加 instance_id 和 user_id 两个标签。
开源版主机监控指标默认添加 host_ip 标签。
TODO
对于Label的处理,后续Loongcollector SPL支持处理Metric后,可以通过SPL进行删除和重命名