Skip to content

Commit

Permalink
Merge branch 'main' into AMLII-1408-remove-start-method-in-favor-of-o…
Browse files Browse the repository at this point in the history
…n-start-hook-in-dogstatsd-server-component

# Conflicts:
#	comp/aggregator/demultiplexer/demultiplexerimpl/demultiplexer.go
  • Loading branch information
gh123man committed Feb 15, 2024
2 parents ba45285 + 7fad488 commit be9fd32
Show file tree
Hide file tree
Showing 124 changed files with 3,605 additions and 1,698 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@
/pkg/process/util/address*.go @DataDog/Networks
/pkg/process/util/netns*.go @DataDog/Networks
/pkg/process/checks/net*.go @DataDog/Networks
/pkg/process/checks/pod*.go @DataDog/container-app
/pkg/process/metadata/parser/ @DataDog/universal-service-monitoring @DataDog/processes @DataDog/Networks
/pkg/process/metadata/parser/*windows* @DataDog/universal-service-monitoring @DataDog/processes @DataDog/Networks @DataDog/windows-kernel-integrations
/pkg/process/monitor/ @DataDog/universal-service-monitoring
Expand All @@ -401,6 +400,9 @@
/pkg/proto/pbgo/languagedetection @DataDog/agent-apm
/pkg/proto/pbgo/process @DataDog/processes
/pkg/proto/pbgo/core @DataDog/agent-shared-components
/pkg/proto/pbgo/core/remoteconfig.pb.go @DataDog/remote-config
/pkg/proto/pbgo/core/remoteconfig_gen.go @DataDog/remote-config
/pkg/proto/pbgo/core/remoteconfig_gen_test.go @DataDog/remote-config
/pkg/proto/pbgo/mocks/core @DataDog/agent-shared-components
/pkg/orchestrator/ @DataDog/container-app
/pkg/network/ @DataDog/Networks
Expand Down
3 changes: 3 additions & 0 deletions .markdown-link-check
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
},
{
"pattern": "^https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/"
},
{
"pattern": "^/security/threats/"
}
],
"replacementPatterns": [
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/jmx/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/DataDog/datadog-agent/comp/aggregator/diagnosesendermanager"
"github.com/DataDog/datadog-agent/comp/aggregator/diagnosesendermanager/diagnosesendermanagerimpl"
internalAPI "github.com/DataDog/datadog-agent/comp/api/api"
"github.com/DataDog/datadog-agent/comp/collector/collector"

"github.com/DataDog/datadog-agent/comp/api/api/apiimpl"
"github.com/DataDog/datadog-agent/comp/core"
Expand Down Expand Up @@ -296,7 +297,7 @@ func runJmxCommandConsole(config config.Component, cliParams *cliParams, wmeta w

// Create the CheckScheduler, but do not attach it to
// AutoDiscovery.
pkgcollector.InitCheckScheduler(optional.NewNoneOption[pkgcollector.Collector](), senderManager)
pkgcollector.InitCheckScheduler(optional.NewNoneOption[collector.Component](), senderManager)

// if cliSelectedChecks is empty, then we want to fetch all check configs;
// otherwise, we fetch only the matching cehck configs.
Expand Down
6 changes: 4 additions & 2 deletions cmd/agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ func startAgent(
// Subscribe to `AGENT_TASK` product
rcclient.SubscribeAgentTask()

// Subscribe to `APM_TRACING` product
rcclient.SubscribeApmTracing()

if pkgconfig.Datadog.GetBool("remote_configuration.agent_integrations.enabled") {
// Spin up the config provider to schedule integrations through remote-config
rcProvider := providers.NewRemoteConfigProvider()
Expand Down Expand Up @@ -584,8 +587,7 @@ func startAgent(

// Set up check collector
commonchecks.RegisterChecks(wmeta)
common.AC.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption[pkgcollector.Collector](collector), demultiplexer), true)
collector.Start()
common.AC.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer), true)
diagnose.Init(optional.NewOption(collector))

demultiplexer.AddAgentStartupTelemetry(version.AgentVersion)
Expand Down
3 changes: 1 addition & 2 deletions cmd/cluster-agent-cloudfoundry/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ func run(log log.Component, taggerComp tagger.Component, demultiplexer demultipl
common.LoadComponents(secretResolver, wmeta, pkgconfig.Datadog.GetString("confd_path"))

// Set up check collector
common.AC.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption[pkgcollector.Collector](collector), demultiplexer), true)
collector.Start()
common.AC.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer), true)
diagnose.Init(optional.NewOption(collector))

// start the autoconfig, this will immediately run any configured check
Expand Down
16 changes: 10 additions & 6 deletions cmd/cluster-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ package start
import (
"context"
"fmt"
"github.com/DataDog/datadog-agent/pkg/util/optional"

"net/http"
"os"
"os/signal"
"sync"
"syscall"
"time"

"github.com/DataDog/datadog-agent/pkg/remoteconfig/state"
"github.com/DataDog/datadog-agent/pkg/util/optional"

"github.com/DataDog/datadog-agent/cmd/agent/common"
"github.com/DataDog/datadog-agent/cmd/agent/common/path"
admissioncmd "github.com/DataDog/datadog-agent/cmd/cluster-agent/admission"
Expand Down Expand Up @@ -51,13 +54,13 @@ import (
"github.com/DataDog/datadog-agent/pkg/clusteragent"
admissionpkg "github.com/DataDog/datadog-agent/pkg/clusteragent/admission"
"github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate"
agentsidecar "github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate/agent_sidecar"
admissionpatch "github.com/DataDog/datadog-agent/pkg/clusteragent/admission/patch"
apidca "github.com/DataDog/datadog-agent/pkg/clusteragent/api"
"github.com/DataDog/datadog-agent/pkg/clusteragent/clusterchecks"
pkgcollector "github.com/DataDog/datadog-agent/pkg/collector"
pkgconfig "github.com/DataDog/datadog-agent/pkg/config"
rcclient "github.com/DataDog/datadog-agent/pkg/config/remote/client"
"github.com/DataDog/datadog-agent/pkg/config/remote/data"
commonsettings "github.com/DataDog/datadog-agent/pkg/config/settings"
"github.com/DataDog/datadog-agent/pkg/status/health"
"github.com/DataDog/datadog-agent/pkg/util"
Expand All @@ -70,7 +73,6 @@ import (
pkglog "github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/version"

"github.com/DataDog/datadog-agent/pkg/clusteragent/languagedetection"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
"go.uber.org/fx"
Expand All @@ -79,6 +81,8 @@ import (
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/record"

"github.com/DataDog/datadog-agent/pkg/clusteragent/languagedetection"

// Core checks

corecheckLoader "github.com/DataDog/datadog-agent/pkg/collector/corechecks"
Expand Down Expand Up @@ -306,8 +310,7 @@ func start(log log.Component, config config.Component, taggerComp tagger.Compone

// Set up check collector
registerChecks()
common.AC.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption[pkgcollector.Collector](collector), demultiplexer), true)
collector.Start()
common.AC.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer), true)

// start the autoconfig, this will immediately run any configured check
common.AC.LoadAndRun(mainCtx)
Expand Down Expand Up @@ -396,6 +399,7 @@ func start(log log.Component, config config.Component, taggerComp tagger.Compone
server.Register(pkgconfig.Datadog.GetString("admission_controller.inject_config.endpoint"), mutate.InjectConfig, apiCl.DynamicCl, apiCl.Cl)
server.Register(pkgconfig.Datadog.GetString("admission_controller.inject_tags.endpoint"), mutate.InjectTags, apiCl.DynamicCl, apiCl.Cl)
server.Register(pkgconfig.Datadog.GetString("admission_controller.auto_instrumentation.endpoint"), mutate.InjectAutoInstrumentation, apiCl.DynamicCl, apiCl.Cl)
server.Register(pkgconfig.Datadog.GetString("admission_controller.agent_sidecar.endpoint"), agentsidecar.InjectAgentSidecar, apiCl.DynamicCl, apiCl.Cl)

// CWS Instrumentation webhooks
cwsInstrumentation, err := mutate.NewCWSInstrumentation()
Expand Down Expand Up @@ -503,7 +507,7 @@ func initializeRemoteConfigClient(ctx context.Context, rcService rccomp.Componen
rcClient, err := rcclient.NewClient(rcService,
rcclient.WithAgent("cluster-agent", version.AgentVersion),
rcclient.WithCluster(clusterName, clusterID),
rcclient.WithProducts([]data.Product{data.ProductAPMTracing}),
rcclient.WithProducts(state.ProductAPMTracing),
rcclient.WithPollInterval(5*time.Second),
rcclient.WithDirectorRootOverride(pkgconfig.Datadog.GetString("remote_configuration.director_root")),
)
Expand Down
14 changes: 8 additions & 6 deletions cmd/trace-agent/config/remote/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ import (
"sync"
"time"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/DataDog/datadog-go/v5/statsd"

rcclient "github.com/DataDog/datadog-agent/pkg/config/remote/client"
pbgo "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core"
"github.com/DataDog/datadog-agent/pkg/trace/api"
"github.com/DataDog/datadog-agent/pkg/trace/config"
"github.com/DataDog/datadog-agent/pkg/trace/timing"
"github.com/DataDog/datadog-agent/pkg/trace/traceutil"
"github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-go/v5/statsd"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

var bufferPool = sync.Pool{
Expand Down Expand Up @@ -76,7 +78,7 @@ func ConfigHandler(r *api.HTTPReceiver, client rcclient.ConfigUpdater, cfg *conf
}
configsRequest.Client.ClientTracer.Tags = append(configsRequest.Client.ClientTracer.Tags, getContainerTags(req, cfg, cidProvider)...)
}
cfg, err := client.ClientGetConfigs(req.Context(), &configsRequest)
cfgResponse, err := client.ClientGetConfigs(req.Context(), &configsRequest)
if err != nil {
statusCode = http.StatusInternalServerError
if e, ok := status.FromError(err); ok {
Expand All @@ -88,12 +90,12 @@ func ConfigHandler(r *api.HTTPReceiver, client rcclient.ConfigUpdater, cfg *conf
http.Error(w, err.Error(), statusCode)
return
}
if cfg == nil {
if cfgResponse == nil {
w.WriteHeader(http.StatusNoContent)
return
}

content, err := json.Marshal(cfg)
content, err := json.Marshal(cfgResponse)
if err != nil {
statusCode = http.StatusInternalServerError
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down
4 changes: 0 additions & 4 deletions comp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,6 @@ Package forwarders implements a component to provide forwarders used by the proc

Package hostinfo wraps the hostinfo inside a component. This is useful because it is relied on by other components.

### [comp/process/podcheck](https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/process/podcheck)

Package podcheck implements a component to handle Kubernetes data collection in the Process Agent.

### [comp/process/processcheck](https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/process/processcheck)

Package processcheck implements a component to handle Process data collection in the Process Agent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ type provides struct {
// implements diagnosesendermanager.Component). This has the nice consequence of preventing having
// demultiplexerimpl.Module and diagnosesendermanagerimpl.Module in the same fx.App because there would
// be two ways to create diagnosesendermanager.Component.
SenderManager diagnosesendermanager.Component
DiagnosticSenderManager diagnosesendermanager.Component
SenderManager sender.SenderManager
StatusProvider status.InformationProvider
AggregatorDemultiplexer aggregator.Demultiplexer
}
Expand Down Expand Up @@ -88,8 +89,9 @@ func newDemultiplexer(deps dependencies) (provides, error) {
}})

return provides{
Comp: demultiplexer,
SenderManager: demultiplexer,
Comp: demultiplexer,
DiagnosticSenderManager: demultiplexer,
SenderManager: demultiplexer,
StatusProvider: status.NewInformationProvider(demultiplexerStatus{
Log: deps.Log,
}),
Expand Down
Loading

0 comments on commit be9fd32

Please sign in to comment.