Skip to content

Commit

Permalink
add rdnsquerier to process-agent subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-schneider committed Oct 16, 2024
1 parent 7aaade0 commit 5c06419
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd/process-agent/subcommands/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
processComponent "github.com/DataDog/datadog-agent/comp/process"
"github.com/DataDog/datadog-agent/comp/process/hostinfo"
"github.com/DataDog/datadog-agent/comp/process/types"
rdnsquerierfx "github.com/DataDog/datadog-agent/comp/rdnsquerier/fx"
"github.com/DataDog/datadog-agent/pkg/process/checks"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/version"
Expand Down Expand Up @@ -124,6 +125,11 @@ func MakeCommand(globalParamsGetter func() *command.GlobalParams, name string, a
// Provide eventplatformimpl module
eventplatformreceiverimpl.Module(),
eventplatformimpl.Module(eventplatformimpl.NewDefaultParams()),

// Provide rdnsquerier module
rdnsquerierfx.Module(),

// Provide npcollector module
npcollectorimpl.Module(),
// Provide the corresponding workloadmeta Params to configure the catalog
wmcatalog.GetCatalog(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ func Module() fxutil.Module {
func newNpCollector(deps dependencies) provides {
var collector *npCollectorImpl

// Note that multiple components can share the same rdnsQuerier instance. If any of them have
// reverse DNS enrichment enabled then the deps.RDNSQuerier component passed here will be an
// active instance. However, we also need to check here whether the netflow component has
// reverse DNS enrichment enabled to decide whether to use the passed instance or to override
// it with a noop implementation.
rdnsQuerier := deps.RDNSQuerier

configs := newConfig(deps.AgentConfig)
if configs.networkPathCollectorEnabled() {
deps.Logger.Debugf("Network Path Collector enabled")
Expand All @@ -53,7 +60,7 @@ func newNpCollector(deps dependencies) provides {
deps.Logger.Errorf("Error getting EpForwarder")
collector = newNoopNpCollectorImpl()
} else {
collector = newNpCollectorImpl(epForwarder, configs, deps.Logger, deps.Telemetry, deps.RDNSQuerier)
collector = newNpCollectorImpl(epForwarder, configs, deps.Logger, deps.Telemetry, rdnsQuerier)
deps.Lc.Append(fx.Hook{
// No need for OnStart hook since NpCollector.Init() will be called by clients when needed.
OnStart: func(context.Context) error {
Expand Down

0 comments on commit 5c06419

Please sign in to comment.