-
Notifications
You must be signed in to change notification settings - Fork 391
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: support singleton input #1933
base: main
Are you sure you want to change the base?
Conversation
Abingcbc
commented
Nov 28, 2024
•
edited
Loading
edited
- 加载流水线时,对只能存在一个实例的input进行限制
- 对加载的配置顺序进行排序,保证先创建的配置,先加载流水线
c99d876
to
5c0d9c8
Compare
bool IsGlobalSingletonProcessorPlugin(const std::string& name) const; | ||
bool IsGlobalSingletonFlusherPlugin(const std::string& name) const; |
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.
processor和flusher没有这种可能,真的有需求了再加
} | ||
return false; | ||
} | ||
|
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.
加个空行
for (const auto& input : inputConfig) { | ||
auto inputType = (*input)["Type"].asString(); | ||
if (PluginRegistry::GetInstance()->IsGlobalSingletonInputPlugin(inputType) | ||
&& mPluginCntMap["inputs"][inputType] > 0) { |
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.
这里判断不对,配置变更的场景,先init再stop老的,这里肯定大于0。不要依赖这个Map,这个map本身以前是用来做自监控的。
bool PreCheckPipelineConfig(PipelineConfig& config); | ||
bool CheckIfGlobalSingletonInputLoaded(std::vector<const Json::Value*>& inputConfig); |
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.
这俩函数合一块就行了
@@ -111,6 +115,10 @@ void logtail::PipelineManager::UpdatePipelines(PipelineConfigDiff& diff) { | |||
ConfigFeedbackStatus::APPLIED); | |||
} | |||
for (auto& config : diff.mAdded) { | |||
if (!PreCheckPipelineConfig(config)) { |
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.
不用在这里特别调用了,直接在buildpipline里面构建input的地方调用就行了
@@ -405,4 +406,23 @@ bool PipelineConfigWatcher::CheckModifiedConfig(const string& configName, | |||
return true; | |||
} | |||
|
|||
void PipelineConfigWatcher::SortPipelineConfigDiff(PipelineConfigDiff& pDiff) { | |||
// sort rule |
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.
一个原本运行的配置,创建时间晚,现在变更了;又有一个原本没运行的配置,创建时间早,新加了,预期行为是什么?现在代码符合预期吗?