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

fix: revert go tag processor #2062

Merged
merged 4 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions core/go_pipeline/LogtailPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ LogtailPlugin::LogtailPlugin() {
mPluginCfg["HostIP"] = LoongCollectorMonitor::mIpAddr;
mPluginCfg["Hostname"] = LoongCollectorMonitor::mHostname;
mPluginCfg["EnableSlsMetricsFormat"] = BOOL_FLAG(enable_sls_metrics_format);
if (!STRING_FLAG(ALIYUN_LOG_FILE_TAGS).empty()) {
mPluginCfg["FileTagsPath"] = GetFileTagsDir();
mPluginCfg["FileTagsInterval"] = INT32_FLAG(file_tags_update_interval);
}
mPluginCfg["AgentHostID"] = STRING_FLAG(agent_host_id);
}

LogtailPlugin::~LogtailPlugin() {
Expand Down
9 changes: 3 additions & 6 deletions pkg/config/global_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ type GlobalConfig struct {
// Checkpoint file name of loongcollector plugin.
LoongCollectorGoCheckPointFile string
// Network identification from loongcollector.
HostIP string
Hostname string
DelayStopSec int
FileTagsPath string
FileTagsInterval int
AgentHostID string
HostIP string
Hostname string
DelayStopSec int

EnableTimestampNanosecond bool
UsingOldContentTag bool
Expand Down
1 change: 0 additions & 1 deletion plugin_main/plugin_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ func initPluginBase(cfgStr string) int {
initOnce.Do(func() {
LoadGlobalConfig(cfgStr)
InitHTTPServer()
pluginmanager.InitFileConfig(&config.LoongcollectorGlobalConfig)
setGCPercentForSlowStart()
logger.Info(context.Background(), "init plugin base, version", config.BaseVersion)
if *flags.DeployMode == flags.DeploySingleton && *flags.EnableKubernetesMeta {
Expand Down
171 changes: 0 additions & 171 deletions pluginmanager/file_config.go

This file was deleted.

117 changes: 0 additions & 117 deletions pluginmanager/file_config_test.go

This file was deleted.

1 change: 0 additions & 1 deletion pluginmanager/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ func StopBuiltInModulesConfig() {
ContainerConfig = nil
}
CheckPointManager.Stop()
StopFileConfig()
}

// Stop stop the given config. ConfigName is with suffix.
Expand Down
31 changes: 0 additions & 31 deletions pluginmanager/processor_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ const (
TagKeyCloudProvider
)

const (
hostNameDefaultTagKey = "__hostname__"
hostIPDefaultTagKey = "__host_ip__"
hostIDDefaultTagKey = "__host_id__"
cloudProviderDefaultTagKey = "__cloud_provider__"
defaultConfigTagKeyValue = "__default__"
)

// Processor interface cannot meet the requirements of tag processing, so we need to create a special ProcessorTag struct
type ProcessorTag struct {
pipelineMetaTagKey map[TagKey]string
Expand Down Expand Up @@ -69,12 +61,7 @@ func (p *ProcessorTag) ProcessV1(logCtx *pipeline.LogWithContext) {
tagsMap[tag.Key] = tag.Value
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

tag三部分
1、输入带过来的
2、host相关的tag
3、环境变量的

刚才v1漏了2,v2是不是也需要1呢?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

v2中的tag是以map结果保存的,所以没有做数据结构的转换,v2的in.Group.Tags里面就已经包含了1

}
// file tags
p.addAllConfigurableTags(tagsMap)
fileTags := fileConfig.GetFileTags()
for k, v := range fileTags {
tagsMap[k] = v.(string)
}
// env tags
for i := 0; i < len(helper.EnvTags); i += 2 {
if len(p.agentEnvMetaTagKey) == 0 && p.appendingAllEnvMetaTag {
Expand Down Expand Up @@ -102,11 +89,6 @@ func (p *ProcessorTag) ProcessV2(in *models.PipelineGroupEvents) {
for k, v := range tagsMap {
in.Group.Tags.Add(k, v)
}
fileTags := fileConfig.GetFileTags()
// file tags
for k, v := range fileTags {
in.Group.Tags.Add(k, v.(string))
}
// env tags
for i := 0; i < len(helper.EnvTags); i += 2 {
if len(p.agentEnvMetaTagKey) == 0 && p.appendingAllEnvMetaTag {
Expand Down Expand Up @@ -136,19 +118,6 @@ func (p *ProcessorTag) parseDefaultAddedTag(configKey string, tagKey TagKey, def
}
}

func (p *ProcessorTag) parseOptionalTag(configKey string, tagKey TagKey, defaultKey string, config map[string]string) {
if customKey, ok := config[configKey]; ok {
if customKey != "" {
if customKey == defaultConfigTagKeyValue {
p.pipelineMetaTagKey[tagKey] = defaultKey
} else {
p.pipelineMetaTagKey[tagKey] = customKey
}
}
// empty value means delete
}
}

func (p *ProcessorTag) addTag(tagKey TagKey, value string, tags map[string]string) {
if key, ok := p.pipelineMetaTagKey[tagKey]; ok {
if key != "" {
Expand Down
Loading
Loading