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

use sync.Once to avoid recalculating tagger.tagstore_use_composite_entity_id on each call #29211

Merged
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
14 changes: 12 additions & 2 deletions pkg/util/tagger/tagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@
// Package tagger provides function to check if the tagger should use composite entity id and object store
package tagger

import pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
import (
"sync"

pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
)

var useCompositeStore bool
var doOnce sync.Once

// ShouldUseCompositeStore indicates whether the tagger should use the default or composite implementation
// of entity ID and object store.
// TODO: remove this when we switch over fully to the composite implementation
func ShouldUseCompositeStore() bool {
return pkgconfigsetup.Datadog().GetBool("tagger.tagstore_use_composite_entity_id")
doOnce.Do(func() {
useCompositeStore = pkgconfigsetup.Datadog().GetBool("tagger.tagstore_use_composite_entity_id")
})
return useCompositeStore
}
Loading