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 remote tagger for non core agents #31076

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 2 additions & 9 deletions cmd/process-agent/command/main_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
dualTaggerfx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-dual"
taggerRemoteFx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-remote"
taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types"
wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
Expand Down Expand Up @@ -177,14 +177,7 @@ func runApp(ctx context.Context, globalParams *GlobalParams) error {
return workloadmeta.Params{AgentType: catalog}
}),

dualTaggerfx.Module(tagger.DualParams{
UseRemote: func(c config.Component) bool {
return c.GetBool("process_config.remote_tagger") ||
// If the agent is running in ECS or ECS Fargate and the ECS task collection is enabled, use the remote tagger
// as remote tagger can return more tags than the local tagger.
((env.IsECS() || env.IsECSFargate()) && c.GetBool("ecs_task_collection_enabled"))
},
}, tagger.Params{}, tagger.RemoteParams{
taggerRemoteFx.Module(tagger.RemoteParams{
RemoteTarget: func(c config.Component) (string, error) {
return fmt.Sprintf(":%v", c.GetInt("cmd_port")), nil
},
Expand Down
8 changes: 2 additions & 6 deletions cmd/process-agent/subcommands/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
log "github.com/DataDog/datadog-agent/comp/core/log/def"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
dualTaggerfx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-dual"
taggerRemoteFx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-remote"
taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types"
wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
Expand Down Expand Up @@ -149,11 +149,7 @@ func MakeCommand(globalParamsGetter func() *command.GlobalParams, name string, a
}),

// Tagger must be initialized after agent config has been setup
dualTaggerfx.Module(tagger.DualParams{
UseRemote: func(c config.Component) bool {
return c.GetBool("process_config.remote_tagger")
},
}, tagger.Params{}, tagger.RemoteParams{
taggerRemoteFx.Module(tagger.RemoteParams{
RemoteTarget: func(c config.Component) (string, error) {
return fmt.Sprintf(":%v", c.GetInt("cmd_port")), nil
},
Expand Down
8 changes: 2 additions & 6 deletions cmd/security-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
dualTaggerfx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-dual"
taggerRemoteFx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-remote"
taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types"
"github.com/DataDog/datadog-agent/comp/core/telemetry"
wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog"
Expand Down Expand Up @@ -113,11 +113,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
AgentType: catalog,
}
}),
dualTaggerfx.Module(tagger.DualParams{
UseRemote: func(c config.Component) bool {
return c.GetBool("security_agent.remote_tagger")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove the config as well, since it's no longer used ?

},
}, tagger.Params{}, tagger.RemoteParams{
taggerRemoteFx.Module(tagger.RemoteParams{
RemoteTarget: func(c config.Component) (string, error) {
return fmt.Sprintf(":%v", c.GetInt("cmd_port")), nil
},
Expand Down
18 changes: 2 additions & 16 deletions cmd/trace-agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/spf13/cobra"
"go.uber.org/fx"

"github.com/DataDog/datadog-agent/cmd/agent/common"
"github.com/DataDog/datadog-agent/cmd/trace-agent/subcommands"
"github.com/DataDog/datadog-agent/comp/agent/autoexit"
"github.com/DataDog/datadog-agent/comp/agent/autoexit/autoexitimpl"
Expand All @@ -27,12 +26,9 @@ import (
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/secrets/secretsimpl"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
dualTaggerfx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-dual"
taggerRemoteFx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-remote"
taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types"
"github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl"
wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
workloadmetafx "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx"
"github.com/DataDog/datadog-agent/comp/dogstatsd/statsd"
"github.com/DataDog/datadog-agent/comp/trace"
traceagent "github.com/DataDog/datadog-agent/comp/trace/agent/def"
Expand Down Expand Up @@ -93,19 +89,9 @@ func runTraceAgentProcess(ctx context.Context, cliParams *Params, defaultConfPat
return log.ForDaemon("TRACE", "apm_config.log_file", config.DefaultLogFilePath)
}),
logtracefx.Module(),
// setup workloadmeta
wmcatalog.GetCatalog(),
workloadmetafx.Module(workloadmeta.Params{
AgentType: workloadmeta.NodeAgent,
InitHelper: common.GetWorkloadmetaInit(),
}),
autoexitimpl.Module(),
statsd.Module(),
dualTaggerfx.Module(tagger.DualParams{
UseRemote: func(c coreconfig.Component) bool {
return c.GetBool("apm_config.remote_tagger")
},
}, tagger.Params{}, tagger.RemoteParams{
taggerRemoteFx.Module(tagger.RemoteParams{
RemoteTarget: func(c coreconfig.Component) (string, error) {
return fmt.Sprintf(":%v", c.GetInt("cmd_port")), nil
},
Expand Down
4 changes: 0 additions & 4 deletions comp/trace/agent/impl/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"go.uber.org/fx"

tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
"github.com/DataDog/datadog-agent/comp/dogstatsd/statsd"
traceagent "github.com/DataDog/datadog-agent/comp/trace/agent/def"
compression "github.com/DataDog/datadog-agent/comp/trace/compression/def"
Expand Down Expand Up @@ -63,7 +62,6 @@ type dependencies struct {
Context context.Context
Params *Params
TelemetryCollector telemetry.TelemetryCollector
Workloadmeta workloadmeta.Component
Statsd statsd.Component
Tagger tagger.Component
Compressor compression.Component
Expand Down Expand Up @@ -91,7 +89,6 @@ type component struct {
params *Params
tagger tagger.Component
telemetryCollector telemetry.TelemetryCollector
workloadmeta workloadmeta.Component
wg *sync.WaitGroup
}

Expand All @@ -111,7 +108,6 @@ func NewAgent(deps dependencies) (traceagent.Component, error) {
cancel: cancel,
config: deps.Config,
params: deps.Params,
workloadmeta: deps.Workloadmeta,
telemetryCollector: deps.TelemetryCollector,
tagger: deps.Tagger,
wg: &sync.WaitGroup{},
Expand Down
Loading