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

add a new remote workloadmeta only catalog #32008

Merged
merged 5 commits into from
Dec 11, 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
2 changes: 1 addition & 1 deletion cmd/system-probe/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types"
"github.com/DataDog/datadog-agent/comp/core/telemetry"
"github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl"
wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog"
wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog-remote"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
workloadmetafx "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx"
compstatsd "github.com/DataDog/datadog-agent/comp/dogstatsd/statsd"
Expand Down
27 changes: 27 additions & 0 deletions comp/core/workloadmeta/collectors/catalog-remote/catalog.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

// Package catalog is a wrapper that loads the available workloadmeta
// collectors. It exists as a shorthand for importing all packages manually in
// all of the agents.
package catalog

import (
"go.uber.org/fx"
)

// GetCatalog returns the set of FX options to populate the catalog
func GetCatalog() fx.Option {
options := getCollectorOptions()

// remove nil options
opts := make([]fx.Option, 0, len(options))
for _, item := range options {
if item != nil {
opts = append(opts, item)
}
}
return fx.Options(opts...)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

//go:build remotewmonly

// Package collectors is a wrapper that loads the available workloadmeta
// Package catalog is a wrapper that loads the available workloadmeta
// collectors. It exists as a shorthand for importing all packages manually in
// all of the agents.
package catalog
Expand All @@ -16,12 +14,15 @@ import (
remoteworkloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/remote/workloadmeta"
)

// TODO: (components) Move remote-only to its own catalog, similar to how catalog-less works
// Depend on this catalog-remote using fx, instead of build tags

func getCollectorOptions() []fx.Option {
return []fx.Option{
remoteworkloadmeta.GetFxOptions(),
remoteWorkloadmetaParams(),
}
}

func remoteWorkloadmetaParams() fx.Option {
return fx.Provide(func() remoteworkloadmeta.Params {
return remoteworkloadmeta.Params{}
})
}
18 changes: 1 addition & 17 deletions comp/core/workloadmeta/collectors/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"go.uber.org/fx"

remoteworkloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/remote/workloadmeta"
workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def"
"github.com/DataDog/datadog-agent/pkg/util/flavor"
)

// GetCatalog returns the set of FX options to populate the catalog
Expand All @@ -30,22 +28,8 @@ func GetCatalog() fx.Option {
return fx.Options(opts...)
}

// TODO: (components) Move remote-only to its own catalog, similar to how catalog-less works
// Depend on this catalog-remote using fx, instead of build tags

func remoteWorkloadmetaParams() fx.Option {
var filter *workloadmeta.Filter // Nil filter accepts everything

// Security Agent is only interested in containers
// TODO: (components) create a Catalog component, the implementation used by
// security-agent can use this filter, instead of needing to chekc agent.flavor
if flavor.GetFlavor() == flavor.SecurityAgent {
filter = workloadmeta.NewFilterBuilder().AddKind(workloadmeta.KindContainer).Build()
}

return fx.Provide(func() remoteworkloadmeta.Params {
return remoteworkloadmeta.Params{
Filter: filter,
}
return remoteworkloadmeta.Params{}
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

// TODO: (components) Move remote-only to its own catalog, similar to how catalog-less works
paulcacheux marked this conversation as resolved.
Show resolved Hide resolved
// Depend on this catalog-remote using fx, instead of build tags

//go:build !remotewmonly

// Package catalog is a wrapper that loads the available workloadmeta
// collectors. It exists as a shorthand for importing all packages manually in
// all of the agents.
Expand Down
3 changes: 1 addition & 2 deletions tasks/build_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"podman",
"process",
"python",
"remotewmonly", # used when you want to use only the remote workloadmeta store without importing all dependencies of local collectors
"sds",
"serverless",
"systemd",
Expand Down Expand Up @@ -162,7 +161,7 @@
SERVERLESS_TAGS = {"serverless", "otlp"}

# SYSTEM_PROBE_TAGS lists the tags necessary to build system-probe
SYSTEM_PROBE_TAGS = AGENT_TAGS.union({"linux_bpf", "npm", "pcap", "remotewmonly"}).difference({"python", "systemd"})
SYSTEM_PROBE_TAGS = AGENT_TAGS.union({"linux_bpf", "npm", "pcap"}).difference({"python", "systemd"})

# TRACE_AGENT_TAGS lists the tags that have to be added when the trace-agent
TRACE_AGENT_TAGS = {"docker", "containerd", "datadog.no_waf", "kubeapiserver", "kubelet", "otlp", "netcgo", "podman"}
Expand Down
Loading