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 parameter errors for container metadata preview. #1430

Merged
merged 7 commits into from
Apr 9, 2024
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
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
Loading