Skip to content

Commit

Permalink
Fix parameter errors for container metadata preview. (#1430)
Browse files Browse the repository at this point in the history
* 容器元信息预览修复

* add GetBaseConfigName

* CollectingContainersMeta

* CollectingContainersMeta

* fix

* delete GetBaseConfigName
  • Loading branch information
quzard authored Apr 9, 2024
1 parent 6e22a0c commit 041df36
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pluginmanager/container_config_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func refreshEnvAndLabel() {
containerLabelSet = make(map[string]struct{})
k8sLabelSet = make(map[string]struct{})
for _, logstoreConfig := range LogtailConfig {
if logstoreConfig.CollectContainersFlag {
if logstoreConfig.CollectingContainersMeta {
for key := range logstoreConfig.EnvSet {
envSet[key] = struct{}{}
}
Expand All @@ -150,7 +150,7 @@ func compareEnvAndLabel() (diffEnvSet, diffContainerLabelSet, diffK8sLabelSet ma
diffContainerLabelSet = make(map[string]struct{})
diffK8sLabelSet = make(map[string]struct{})
for _, logstoreConfig := range LogtailConfig {
if logstoreConfig.CollectContainersFlag {
if logstoreConfig.CollectingContainersMeta {
for key := range logstoreConfig.EnvSet {
if _, ok := envSet[key]; !ok {
envSet[key] = struct{}{}
Expand Down Expand Up @@ -268,7 +268,7 @@ func compareEnvAndLabelAndRecordContainer() []*helper.ContainerDetail {

func isCollectContainers() bool {
for _, logstoreConfig := range LogtailConfig {
if logstoreConfig.CollectContainersFlag {
if logstoreConfig.CollectingContainersMeta {
return true
}
}
Expand Down
16 changes: 11 additions & 5 deletions pluginmanager/logstore_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ type LogstoreConfig struct {
// flushWaitSema sync.WaitGroup
pauseOrResumeWg sync.WaitGroup

K8sLabelSet map[string]struct{}
ContainerLabelSet map[string]struct{}
EnvSet map[string]struct{}
CollectContainersFlag bool
K8sLabelSet map[string]struct{}
ContainerLabelSet map[string]struct{}
EnvSet map[string]struct{}
CollectingContainersMeta bool
}

func (p *LogstoreStatistics) Init(context pipeline.Context) {
Expand Down Expand Up @@ -487,7 +487,13 @@ func createLogstoreConfig(project string, logstore string, configName string, lo
if !valid {
continue
}
logstoreC.CollectContainersFlag = collectContainersFlag
logstoreC.CollectingContainersMeta = collectContainersFlag
} else if strings.Contains(lowerKey, "collectingcontainersmeta") {
collectingContainersMeta, valid := value.(bool)
if !valid {
continue
}
logstoreC.CollectingContainersMeta = collectingContainersMeta
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions plugins/input/docker/logmeta/metric_docker_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ type InputDockerFile struct {
lastUpdateTime int64

// Last return of GetAllAcceptedInfoV2
fullList map[string]bool
matchList map[string]*helper.DockerInfoDetail
CollectContainersFlag bool
firstStart bool
fullList map[string]bool
matchList map[string]*helper.DockerInfoDetail
CollectingContainersMeta bool
firstStart bool
}

func formatPath(path string) string {
Expand Down Expand Up @@ -343,7 +343,7 @@ func (idf *InputDockerFile) Collect(collector pipeline.Collector) error {
logger.Warning(idf.context.GetRuntimeContext(), "DOCKER_FILE_MATCH_ALARM", "unknow error", "can't find path from this container", "path", idf.LogPath, "container", info.ContainerInfo.Name)
}
}
if idf.CollectContainersFlag {
if idf.CollectingContainersMeta {
configResult := &helper.ContainerConfigResult{
DataType: "container_config_result",
Project: idf.context.GetProject(),
Expand Down

0 comments on commit 041df36

Please sign in to comment.