Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zhengda authored Dec 20, 2024
2 parents 5ff737c + 395cb8e commit 073f39e
Show file tree
Hide file tree
Showing 242 changed files with 2,414 additions and 1,665 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
/.gitlab/deploy_dca/ @DataDog/container-integrations @DataDog/agent-delivery

/.gitlab/deploy_packages/ @DataDog/agent-delivery
/.gitlab/deploy_packages/oci.yml @DataDog/agent-delivery @DataDog/fleet
/.gitlab/deploy_packages/windows.yml @DataDog/agent-delivery @DataDog/windows-agent
/.gitlab/deploy_packages/winget.yml @DataDog/agent-delivery @DataDog/windows-agent
/.gitlab/deploy_packages/cluster_agent_cloudfoundry.yml @DataDog/platform-integrations @DataDog/agent-devx-infra
Expand Down
6 changes: 6 additions & 0 deletions .gitlab/deploy_packages/oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ include:
- datadog-package replicate-s3 registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} us-east-1 ${INSTALLER_TESTING_S3_BUCKET} ${S3_PACKAGE} ${VERSION}
- datadog-package replicate-s3 registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} us-east-1 ${INSTALLER_TESTING_S3_BUCKET} ${S3_PACKAGE} ${CI_COMMIT_SHA}
- datadog-package replicate-s3 registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} us-east-1 ${INSTALLER_TESTING_S3_BUCKET} ${S3_PACKAGE} pipeline-${CI_PIPELINE_ID}
# necessary for ddstaging until we deprecate `-dev` packaging
- datadog-package replicate-s3 registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} us-east-1 ${INSTALLER_TESTING_S3_BUCKET} ${S3_STAGING_PACKAGE} ${VERSION}
- datadog-package replicate-s3 registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} us-east-1 ${INSTALLER_TESTING_S3_BUCKET} ${S3_STAGING_PACKAGE} ${CI_COMMIT_SHA}
- datadog-package replicate-s3 registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} us-east-1 ${INSTALLER_TESTING_S3_BUCKET} ${S3_STAGING_PACKAGE} pipeline-${CI_PIPELINE_ID}
variables:
MAJOR_VERSION: 7

Expand All @@ -37,10 +41,12 @@ deploy_agent_oci:
variables:
OCI_PRODUCT: "datadog-agent"
S3_PACKAGE: "agent-package"
S3_STAGING_PACKAGE: "agent-package-dev"

deploy_installer_oci:
extends: ".deploy_packages_oci"
needs: [ "installer_oci", "go_tools_deps" ]
variables:
OCI_PRODUCT: "datadog-installer"
S3_PACKAGE: "installer-package"
S3_STAGING_PACKAGE: "installer-package-dev"
13 changes: 13 additions & 0 deletions CHANGELOG-DCA.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
Release Notes
=============

.. _Release Notes_7.60.1:

7.60.1
======

.. _Release Notes_7.60.1_Prelude:

Prelude
-------

Released on: 2024-12-19
Pinned to datadog-agent v7.60.1: `CHANGELOG <https://github.com/DataDog/datadog-agent/blob/main/CHANGELOG.rst#7601>`_.

.. _Release Notes_7.60.0:

7.60.0
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
Release Notes
=============

.. _Release Notes_7.60.1:

7.60.1
======

.. _Release Notes_7.60.1_Prelude:

Prelude
-------

Release on: 2024-12-19


.. _Release Notes_7.60.1_Security Notes:

Security Notes
--------------

- Update ``golang.org/x/crypto`` to fix CVE-2024-45337.


.. _Release Notes_7.60.0:

7.60.0
Expand Down
15 changes: 14 additions & 1 deletion cmd/agent/dist/conf.d/cpu.d/conf.yaml.default
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
## This file is overwritten upon Agent upgrade.
## To make modifications to the check configuration, copy this file
## to `cpu.yaml` and make your changes on that file.

init_config:

## The Cpu check only supports one configured instance.

instances:
- {}
-

## @param report_total_percpu - boolean - required
## Set to true to report cpu total metrics for each cpu.
#
# report_total_percpu: false
22 changes: 15 additions & 7 deletions cmd/agent/subcommands/flare/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,18 @@ func readProfileData(seconds int) (flare.ProfileData, error) {

type pprofGetter func(path string) ([]byte, error)

tcpGet := func(portConfig string) pprofGetter {
pprofURL := fmt.Sprintf("http://127.0.0.1:%d/debug/pprof", pkgconfigsetup.Datadog().GetInt(portConfig))
tcpGet := func(portConfig string, onHTTPS bool) pprofGetter {
endpoint := url.URL{
Scheme: "http",
Host: net.JoinHostPort("127.0.0.1", strconv.Itoa(pkgconfigsetup.Datadog().GetInt(portConfig))),
Path: "/debug/pprof",
}
if onHTTPS {
endpoint.Scheme = "https"
}

return func(path string) ([]byte, error) {
return util.DoGet(c, pprofURL+path, util.LeaveConnectionOpen)
return util.DoGet(c, endpoint.String()+path, util.LeaveConnectionOpen)
}
}

Expand Down Expand Up @@ -228,15 +236,15 @@ func readProfileData(seconds int) (flare.ProfileData, error) {
}

agentCollectors := map[string]agentProfileCollector{
"core": serviceProfileCollector(tcpGet("expvar_port"), seconds),
"security-agent": serviceProfileCollector(tcpGet("security_agent.expvar_port"), seconds),
"core": serviceProfileCollector(tcpGet("expvar_port", false), seconds),
"security-agent": serviceProfileCollector(tcpGet("security_agent.expvar_port", false), seconds),
}

if pkgconfigsetup.Datadog().GetBool("process_config.enabled") ||
pkgconfigsetup.Datadog().GetBool("process_config.container_collection.enabled") ||
pkgconfigsetup.Datadog().GetBool("process_config.process_collection.enabled") {

agentCollectors["process"] = serviceProfileCollector(tcpGet("process_config.expvar_port"), seconds)
agentCollectors["process"] = serviceProfileCollector(tcpGet("process_config.expvar_port", false), seconds)
}

if pkgconfigsetup.Datadog().GetBool("apm_config.enabled") {
Expand All @@ -249,7 +257,7 @@ func readProfileData(seconds int) (flare.ProfileData, error) {
traceCpusec = 4
}

agentCollectors["trace"] = serviceProfileCollector(tcpGet("apm_config.debug.port"), traceCpusec)
agentCollectors["trace"] = serviceProfileCollector(tcpGet("apm_config.debug.port", true), traceCpusec)
}

if pkgconfigsetup.SystemProbe().GetBool("system_probe_config.enabled") {
Expand Down
18 changes: 14 additions & 4 deletions cmd/agent/subcommands/flare/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type commandTestSuite struct {
suite.Suite
sysprobeSocketPath string
tcpServer *httptest.Server
tcpTLSServer *httptest.Server
unixServer *httptest.Server
systemProbeServer *httptest.Server
}
Expand All @@ -42,13 +43,17 @@ func (c *commandTestSuite) SetupSuite() {
// This should be called by each test that requires them.
func (c *commandTestSuite) startTestServers() {
t := c.T()
c.tcpServer, c.unixServer, c.systemProbeServer = c.getPprofTestServer()
c.tcpServer, c.tcpTLSServer, c.unixServer, c.systemProbeServer = c.getPprofTestServer()

t.Cleanup(func() {
if c.tcpServer != nil {
c.tcpServer.Close()
c.tcpServer = nil
}
if c.tcpTLSServer != nil {
c.tcpTLSServer.Close()
c.tcpTLSServer = nil
}
if c.unixServer != nil {
c.unixServer.Close()
c.unixServer = nil
Expand Down Expand Up @@ -82,12 +87,13 @@ func newMockHandler() http.HandlerFunc {
})
}

func (c *commandTestSuite) getPprofTestServer() (tcpServer *httptest.Server, unixServer *httptest.Server, sysProbeServer *httptest.Server) {
func (c *commandTestSuite) getPprofTestServer() (tcpServer *httptest.Server, tcpTLSServer *httptest.Server, unixServer *httptest.Server, sysProbeServer *httptest.Server) {
var err error
t := c.T()

handler := newMockHandler()
tcpServer = httptest.NewServer(handler)
tcpTLSServer = httptest.NewTLSServer(handler)
if runtime.GOOS == "linux" {
unixServer = httptest.NewUnstartedServer(handler)
unixServer.Listener, err = net.Listen("unix", c.sysprobeSocketPath)
Expand All @@ -101,7 +107,7 @@ func (c *commandTestSuite) getPprofTestServer() (tcpServer *httptest.Server, uni
sysProbeServer.Start()
}

return tcpServer, unixServer, sysProbeServer
return tcpServer, tcpTLSServer, unixServer, sysProbeServer
}

func TestCommandTestSuite(t *testing.T) {
Expand All @@ -116,10 +122,14 @@ func (c *commandTestSuite) TestReadProfileData() {
require.NoError(t, err)
port := u.Port()

u, err = url.Parse(c.tcpTLSServer.URL)
require.NoError(t, err)
httpsPort := u.Port()

mockConfig := configmock.New(t)
mockConfig.SetWithoutSource("expvar_port", port)
mockConfig.SetWithoutSource("apm_config.enabled", true)
mockConfig.SetWithoutSource("apm_config.debug.port", port)
mockConfig.SetWithoutSource("apm_config.debug.port", httpsPort)
mockConfig.SetWithoutSource("apm_config.receiver_timeout", "10")
mockConfig.SetWithoutSource("process_config.expvar_port", port)
mockConfig.SetWithoutSource("security_agent.expvar_port", port)
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/subcommands/secret/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func traceAgentSecretRefresh(conf config.Component) ([]byte, error) {
c := apiutil.GetClient(false)
c.Timeout = conf.GetDuration("server_timeout") * time.Second

url := fmt.Sprintf("http://127.0.0.1:%d/secret/refresh", port)
url := fmt.Sprintf("https://127.0.0.1:%d/secret/refresh", port)
res, err := apiutil.DoGet(c, url, apiutil.CloseConnection)
if err != nil {
return nil, fmt.Errorf("could not contact trace-agent: %s", err)
Expand Down
92 changes: 57 additions & 35 deletions comp/remote-config/rcclient/rcclientimpl/rcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ func (rc rcClient) start() {
}
}

// mrfUpdateCallback is the callback function for the AGENT_FAILOVER configs.
// It fetches all the configs targeting the agent and applies the failover settings
// using an OR strategy. In case of nil the value is not updated, for a false it does not update if
// the setting is already set to true.
func (rc rcClient) mrfUpdateCallback(updates map[string]state.RawConfig, applyStateCallback func(string, state.ApplyStatus)) {
// If the updates map is empty, we should unset the failover settings if they were set via RC previously
if len(updates) == 0 {
Expand All @@ -188,8 +192,13 @@ func (rc rcClient) mrfUpdateCallback(updates map[string]state.RawConfig, applySt
return
}

applied := false
var enableLogs, enableMetrics *bool
var enableLogsCfgPth, enableMetricsCfgPth string
for cfgPath, update := range updates {
if (enableLogs != nil && *enableLogs) && (enableMetrics != nil && *enableMetrics) {
break
}

mrfUpdate, err := parseMultiRegionFailoverConfig(update.Config)
if err != nil {
pkglog.Errorf("Multi-Region Failover update unmarshal failed: %s", err)
Expand All @@ -200,42 +209,55 @@ func (rc rcClient) mrfUpdateCallback(updates map[string]state.RawConfig, applySt
continue
}

if mrfUpdate != nil && (mrfUpdate.FailoverMetrics != nil || mrfUpdate.FailoverLogs != nil) {
// If we've received multiple config files updating the failover settings, we should disregard all but the first update and log it, as this is unexpected
if applied {
pkglog.Warnf("Multiple Multi-Region Failover updates received, disregarding update of `multi_region_failover.failover_metrics` to %v and `multi_region_failover.failover_logs` to %v", mrfUpdate.FailoverMetrics, mrfUpdate.FailoverLogs)
applyStateCallback(cfgPath, state.ApplyStatus{
State: state.ApplyStateError,
Error: "Multiple Multi-Region Failover updates received. Only the first was applied.",
})
continue
}
if mrfUpdate == nil || (mrfUpdate.FailoverMetrics == nil && mrfUpdate.FailoverLogs == nil) {
continue
}

if mrfUpdate.FailoverMetrics != nil {
err = rc.applyMRFRuntimeSetting("multi_region_failover.failover_metrics", *mrfUpdate.FailoverMetrics, cfgPath, applyStateCallback)
if err != nil {
continue
}
change := "disabled"
if *mrfUpdate.FailoverMetrics {
change = "enabled"
}
pkglog.Infof("Received remote update for Multi-Region Failover configuration: %s failover for metrics", change)
}
if mrfUpdate.FailoverLogs != nil {
err = rc.applyMRFRuntimeSetting("multi_region_failover.failover_logs", *mrfUpdate.FailoverLogs, cfgPath, applyStateCallback)
if err != nil {
continue
}
change := "disabled"
if *mrfUpdate.FailoverLogs {
change = "enabled"
}
pkglog.Infof("Received remote update for Multi-Region Failover configuration: %s failover for logs", change)
}
applyStateCallback(cfgPath, state.ApplyStatus{State: state.ApplyStateAcknowledged})
applied = true
if !(enableMetrics != nil && *enableMetrics) && mrfUpdate.FailoverMetrics != nil {
enableMetrics = mrfUpdate.FailoverMetrics
enableMetricsCfgPth = cfgPath
}

if !(enableLogs != nil && *enableLogs) && mrfUpdate.FailoverLogs != nil {
enableLogs = mrfUpdate.FailoverLogs
enableLogsCfgPth = cfgPath
}
}

if enableMetrics != nil {
err := rc.applyMRFRuntimeSetting("multi_region_failover.failover_metrics", *enableMetrics, enableMetricsCfgPth, applyStateCallback)
if err != nil {
pkglog.Errorf("Multi-Region Failover failed to apply new metrics settings : %s", err)
applyStateCallback(enableMetricsCfgPth, state.ApplyStatus{
State: state.ApplyStateError,
Error: err.Error(),
})
return
}
change := "disabled"
if *enableMetrics {
change = "enabled"
}
pkglog.Infof("Received remote update for Multi-Region Failover configuration: %s failover for metrics", change)
applyStateCallback(enableMetricsCfgPth, state.ApplyStatus{State: state.ApplyStateAcknowledged})
}

if enableLogs != nil {
err := rc.applyMRFRuntimeSetting("multi_region_failover.failover_logs", *enableLogs, enableLogsCfgPth, applyStateCallback)
if err != nil {
pkglog.Errorf("Multi-Region Failover failed to apply new logs settings : %s", err)
applyStateCallback(enableMetricsCfgPth, state.ApplyStatus{
State: state.ApplyStateError,
Error: err.Error(),
})
return
}
change := "disabled"
if *enableLogs {
change = "enabled"
}
pkglog.Infof("Received remote update for Multi-Region Failover configuration: %s failover for logs", change)
applyStateCallback(enableLogsCfgPth, state.ApplyStatus{State: state.ApplyStateAcknowledged})
}
}

Expand Down
Loading

0 comments on commit 073f39e

Please sign in to comment.