Skip to content

Commit

Permalink
fix: revert go tag processor (#2062)
Browse files Browse the repository at this point in the history
* fix: revert go tag processor

* fix

* fix

* fix
  • Loading branch information
Abingcbc authored Feb 7, 2025
1 parent 13d9a5d commit b60b6e6
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 348 deletions.
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
}
}
// 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

0 comments on commit b60b6e6

Please sign in to comment.