Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: support singleton input #1933

wants to merge 1 commit into from

Conversation

Abingcbc
Copy link
Collaborator

@Abingcbc Abingcbc commented Nov 28, 2024

  1. 加载流水线时,对只能存在一个实例的input进行限制
  2. 对加载的配置顺序进行排序,保证先创建的配置,先加载流水线

Comment on lines +58 to +59
bool IsGlobalSingletonProcessorPlugin(const std::string& name) const;
bool IsGlobalSingletonFlusherPlugin(const std::string& name) const;
Copy link
Collaborator

Choose a reason for hiding this comment

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

processor和flusher没有这种可能,真的有需求了再加

}
return false;
}

Copy link
Collaborator

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) {
Copy link
Collaborator

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本身以前是用来做自监控的。

Comment on lines +61 to +62
bool PreCheckPipelineConfig(PipelineConfig& config);
bool CheckIfGlobalSingletonInputLoaded(std::vector<const Json::Value*>& inputConfig);
Copy link
Collaborator

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)) {
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

一个原本运行的配置,创建时间晚,现在变更了;又有一个原本没运行的配置,创建时间早,新加了,预期行为是什么?现在代码符合预期吗?

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.

2 participants