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

test all services clean exit #31331

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
73129b5
Add Testing for all services when disabled
jack0x2 Nov 21, 2024
4f5055b
updates security-agent on windows to output info event on clean exit …
jack0x2 Nov 21, 2024
033ab9e
Modify pipeline e2e tests for services
jack0x2 Nov 21, 2024
b7b965b
[OTEL-2180] remove duplicated otel configs (#30941)
songy23 Nov 20, 2024
2beac97
Revert "[NPM] Allow safely overriding connections check interval" (#3…
akarpz Nov 20, 2024
d2d2d8b
fix(installer): Forward hostname from daemon to installer (#31284)
BaptisteFoy Nov 21, 2024
24498d6
CI: rpm: fix incorrect variable (#31290)
chouquette Nov 21, 2024
e0d05e1
[BARX-598] Deploy new 2022 and 2019 windows images (#31178)
AliDatadog Nov 21, 2024
6e918c5
[test-infra-definitions][automated] Bump test-infra-definitions to be…
agent-platform-auto-pr[bot] Nov 21, 2024
5df90e1
[CWS] Remove `connect.server.*` secl field aliases (#31218)
YoannGh Nov 21, 2024
5f1da9b
Revert "[test-infra-definitions][automated] Bump test-infra-definitio…
amenasria Nov 21, 2024
245a617
[CWS] Fix file.flags JSON schema (#31294)
lebauce Nov 21, 2024
aa7f484
[CWS] make sure stress tests are build gated on linux (#31315)
paulcacheux Nov 21, 2024
8b99e48
[ha-agent] Add haagent component (#30910)
AlexandreYang Nov 21, 2024
2358704
[tagger/mock] Refactor to use fake impl directly and avoid unwanted d…
davidor Nov 21, 2024
ba21ba4
[CWS] fix `TestLoaderCompile` build (#31309)
paulcacheux Nov 21, 2024
f66c4f7
ensure remote tagger do not block when starting (#31279)
GustavoCaso Nov 21, 2024
8d867cb
usm: Enable event stream by default (#31262)
vitkyrka Nov 21, 2024
1063084
updates e2e service test
jack0x2 Nov 21, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
/comp/trace/etwtracer @DataDog/windows-agent
/comp/autoscaling/datadogclient @DataDog/container-integrations
/comp/etw @DataDog/windows-agent
/comp/haagent @DataDog/ndm-core
/comp/languagedetection/client @DataDog/container-platform
/comp/rdnsquerier @DataDog/ndm-integrations
/comp/serializer/compression @DataDog/agent-metrics-logs
Expand Down
56 changes: 56 additions & 0 deletions .gitlab/deploy_containers/deploy_containers_a7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ include:
- if [[ "$FLAVOR" == "-linux" ]]; then export IMG_SOURCES="${IMG_LINUX_SOURCES}"; elif [[ "$FLAVOR" == "-servercore" ]]; then export IMG_SOURCES="${IMG_WINDOWS_SOURCES}"; else export IMG_SOURCES="${IMG_LINUX_SOURCES},${IMG_WINDOWS_SOURCES}"; fi
- export IMG_DESTINATIONS="${AGENT_REPOSITORY}:${VERSION}${FLAVOR}${JMX}"

.deploy_containers-a7_win_only_image:
extends: .docker_publish_job_definition
stage: deploy_containers
dependencies: []
before_script:
- OS=$(echo $OS_LTSC_MAPPING | cut -d ':' -f 1)
- LTSC_VERSION=$(echo $OS_LTSC_MAPPING | cut -d ':' -f 2)
- if [[ "$VERSION" == "" ]]; then VERSION="$(inv agent.version --major-version 7 --url-safe --pipeline-id $PARENT_PIPELINE_ID)" || exit $?; fi
- IMG_BASE_SRC="${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}"
- export IMG_SOURCES="${IMG_BASE_SRC}-7${JMX}-win${OS}${FLAVOR}-amd64"
- export IMG_DESTINATIONS="${AGENT_REPOSITORY}:${VERSION}${FLAVOR}-ltsc${LTSC_VERSION}${JMX}"

.deploy_containers-a7_external:
extends: .deploy_containers-a7-base
Expand All @@ -45,6 +56,20 @@ include:
- "-servercore"
- "-linux"

.deploy_containers-a7_win_only_external:
extends: .deploy_containers-a7_win_only_image
parallel:
matrix:
- JMX:
- ""
- "-jmx"
OS_LTSC_MAPPING:
- "ltsc2022:2022"
- "1809:2019"
FLAVOR:
- ""
- "-servercore"

.deploy_containers-a7-base-ot:
extends: .docker_publish_job_definition
stage: deploy_containers
Expand All @@ -59,6 +84,11 @@ deploy_containers-a7:
rules:
!reference [.manual_on_deploy_auto_on_rc]

deploy_containers-a7-win-only:
extends: .deploy_containers-a7_win_only_external
rules:
!reference [.manual_on_deploy_auto_on_rc]

deploy_containers-a7-ot:
extends: .deploy_containers-a7-base-ot
rules:
Expand All @@ -76,6 +106,13 @@ deploy_containers-a7-rc:
variables:
VERSION: 7-rc

deploy_containers-a7-win-only-rc:
extends: .deploy_containers-a7_win_only_external
rules:
!reference [.on_rc]
variables:
VERSION: 7-rc

deploy_containers-a7-ot-rc:
extends: .deploy_containers-a7-base-ot
rules:
Expand Down Expand Up @@ -159,6 +196,25 @@ deploy_containers_latest-a7:
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64,%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7-servercore-jmx,${AGENT_REPOSITORY}:latest-servercore-jmx
# Windows only images
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7,${AGENT_REPOSITORY}:latest-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7,${AGENT_REPOSITORY}:latest-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7-servercore-ltsc2019,${AGENT_REPOSITORY}:latest-servercore-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7-servercore-ltsc2022,${AGENT_REPOSITORY}:latest-servercore-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7-servercore-ltsc2022-jmx,${AGENT_REPOSITORY}:latest-servercore-ltsc2022-jmx
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${PARENT_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc1809-servercore-amd64"
IMG_DESTINATIONS: ${AGENT_REPOSITORY}:7-servercore-ltsc2019-jmx,${AGENT_REPOSITORY}:latest-servercore-ltsc2019-jmx

deploy_containers_latest-a7_internal:
extends: .docker_publish_job_definition
Expand Down
81 changes: 81 additions & 0 deletions .gitlab/dev_container_deploy/docker_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dev_branch-a7-windows:
IMG_REGISTRIES: dev
parallel:
matrix:
# Multi-arch
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64,%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win
Expand All @@ -32,6 +33,32 @@ dev_branch-a7-windows:
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64,%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore
# ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-servercore-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore-ltsc2019
# ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-servercore-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore-ltsc2022

dev_master-a7-windows:
extends: .docker_publish_job_definition
Expand All @@ -51,6 +78,7 @@ dev_master-a7-windows:
IMG_REGISTRIES: dev
parallel:
matrix:
# Multi-arch
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64,%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:master-py3-win
Expand All @@ -63,6 +91,32 @@ dev_master-a7-windows:
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64,%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:master-py3-jmx-win-servercore
# ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-servercore-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore-ltsc2019
# ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-servercore-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore-ltsc2022

dev_nightly-a7-windows:
extends: .docker_publish_job_definition
Expand All @@ -82,6 +136,7 @@ dev_nightly-a7-windows:
IMG_REGISTRIES: dev
parallel:
matrix:
# Multi-arch
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64,%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:nightly-${CI_COMMIT_SHORT_SHA}-py3-win
Expand All @@ -94,3 +149,29 @@ dev_nightly-a7-windows:
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64,%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:nightly-${CI_COMMIT_SHORT_SHA}-py3-jmx-win-servercore
# ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-servercore-ltsc2019
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-win1809-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore-ltsc2019
# ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-win-servercore-ltsc2022
- IMG_VARIABLES: "BASE=${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx"
IMG_SOURCES: "%BASE%-winltsc2022-servercore-amd64"
IMG_DESTINATIONS: agent-dev:${CI_COMMIT_REF_SLUG}-py3-jmx-win-servercore-ltsc2022
20 changes: 5 additions & 15 deletions .gitlab/e2e/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,11 @@ new-e2e-windows-service-test:
variables:
TARGETS: ./tests/windows/service-test
TEAM: windows-agent
EXTRA_PARAMS: --run TestServiceBehavior

# Temporary job for hunting a crash
new-e2e-windows-service-test-nofim:
extends: .new_e2e_template
needs:
- !reference [.needs_new_e2e_template]
- deploy_windows_testing-a7
rules:
- !reference [.on_windows_service_or_e2e_changes]
- !reference [.manual]
variables:
TARGETS: ./tests/windows/service-test
TEAM: windows-agent
EXTRA_PARAMS: --run TestNoFIMServiceBehavior
parallel:
matrix:
- EXTRA_PARAMS: --run TestServiceBehaviorAgentCommand
- EXTRA_PARAMS: --run TestServiceBehaviorPowerShell
- EXTRA_PARAMS: --run TestServiceBehaviorWhenDisabled

new-e2e-language-detection:
extends: .new_e2e_template_needs_deb_x64
Expand Down
4 changes: 2 additions & 2 deletions .gitlab/packaging/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ agent_suse-x64-a7:
extends: [.package_suse_rpm_common, .package_rpm_agent_7, .package_rpm_x86]
needs: ["datadog-agent-7-x64"]
variables:
DD_PRODUCT: agent
DD_PROJECT: agent

agent_suse-arm64-a7:
extends: [.package_suse_rpm_common, .package_rpm_agent_7, .package_rpm_arm64]
needs: ["datadog-agent-7-arm64"]
variables:
DD_PRODUCT: agent
DD_PROJECT: agent

installer_rpm-amd64:
extends: [.package_rpm_common, .package_rpm_agent_7, .package_rpm_x86]
Expand Down
2 changes: 2 additions & 0 deletions cmd/agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
internalsettings "github.com/DataDog/datadog-agent/cmd/agent/subcommands/run/internal/settings"
agenttelemetry "github.com/DataDog/datadog-agent/comp/core/agenttelemetry/def"
agenttelemetryfx "github.com/DataDog/datadog-agent/comp/core/agenttelemetry/fx"
haagentfx "github.com/DataDog/datadog-agent/comp/haagent/fx"

// checks implemented as components

Expand Down Expand Up @@ -472,6 +473,7 @@ func getSharedFxOption() fx.Option {
agenttelemetryfx.Module(),
networkpath.Bundle(),
remoteagentregistryfx.Module(),
haagentfx.Module(),
)
}

Expand Down
26 changes: 17 additions & 9 deletions cmd/otel-agent/config/agent_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ import (
"fmt"
"strings"

"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/datadogexporter"
pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
datadogconfig "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/provider/envprovider"
"go.opentelemetry.io/collector/confmap/provider/fileprovider"
"go.opentelemetry.io/collector/confmap/provider/httpprovider"
"go.opentelemetry.io/collector/confmap/provider/httpsprovider"
"go.opentelemetry.io/collector/confmap/provider/yamlprovider"
"go.opentelemetry.io/collector/service"

"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/datadogexporter"
pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
)

type logLevel int
Expand Down Expand Up @@ -204,8 +206,8 @@ func getServiceConfig(cfg *confmap.Conf) (*service.Config, error) {
return pipelineConfig, nil
}

func getDDExporterConfig(cfg *confmap.Conf) (*datadogexporter.Config, error) {
var configs []*datadogexporter.Config
func getDDExporterConfig(cfg *confmap.Conf) (*datadogconfig.Config, error) {
var configs []*datadogconfig.Config
var err error
for k, v := range cfg.ToStringMap() {
if k != "exporters" {
Expand All @@ -217,16 +219,22 @@ func getDDExporterConfig(cfg *confmap.Conf) (*datadogexporter.Config, error) {
}
for k, v := range exporters {
if strings.HasPrefix(k, "datadog") {
datadogConfig := datadogexporter.CreateDefaultConfig().(*datadogexporter.Config)
ddcfg := datadogexporter.CreateDefaultConfig().(*datadogconfig.Config)
m, ok := v.(map[string]any)
if !ok {
return nil, fmt.Errorf("invalid datadog exporter config")
}
err = confmap.NewFromStringMap(m).Unmarshal(&datadogConfig)
err = confmap.NewFromStringMap(m).Unmarshal(&ddcfg)
if err != nil {
return nil, err
}
configs = append(configs, datadogConfig)
if strings.Contains(ddcfg.Logs.Endpoint, "http-intake") && !strings.Contains(ddcfg.Logs.Endpoint, "agent-http-intake") {
// datadogconfig.Config sets logs endpoint to https://http-intake.logs.{DD_SITE} by default
// while in converged agent we want https://agent-http-intake.logs.{DD_SITE}
ddcfg.Logs.Endpoint = strings.Replace(ddcfg.Logs.Endpoint, "http-intake", "agent-http-intake", 1)
}

configs = append(configs, ddcfg)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/otel-agent/config/agent_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type ConfigTestSuite struct {

func (suite *ConfigTestSuite) SetupTest() {
configmock.New(suite.T())
suite.T().Setenv("DD_API_KEY", "")
suite.T().Setenv("DD_SITE", "")
}

func TestNoURIsProvided(t *testing.T) {
Expand Down
6 changes: 6 additions & 0 deletions cmd/security-agent/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ package main

import (
"context"
"errors"
"fmt"
"os"
"path"

Expand Down Expand Up @@ -94,6 +96,10 @@ func (s *service) Run(svcctx context.Context) error {

err := start.RunAgent(log, config, telemetry, statusComponent, settings, wmeta)
if err != nil {
if errors.Is(err, start.ErrAllComponentsDisabled) {
// If all components are disabled, we should exit cleanly
return fmt.Errorf("%w: %w", servicemain.ErrCleanStopAfterInit, err)
}
return err
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/security-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func start(log log.Component, config config.Component, _ secrets.Component, _ st
defer StopAgent(log)

err := RunAgent(log, config, telemetry, statusComponent, settings, wmeta)
if errors.Is(err, errAllComponentsDisabled) || errors.Is(err, errNoAPIKeyConfigured) {
if errors.Is(err, ErrAllComponentsDisabled) || errors.Is(err, errNoAPIKeyConfigured) {
return nil
}
if err != nil {
Expand Down Expand Up @@ -257,7 +257,7 @@ var (
expvarServer *http.Server
)

var errAllComponentsDisabled = errors.New("all security-agent component are disabled")
var ErrAllComponentsDisabled = errors.New("all security-agent component are disabled")
var errNoAPIKeyConfigured = errors.New("no API key configured")

// RunAgent initialized resources and starts API server
Expand All @@ -274,7 +274,7 @@ func RunAgent(log log.Component, config config.Component, telemetry telemetry.Co
// to startup because of an error. Only applies on Debian 7.
time.Sleep(5 * time.Second)

return errAllComponentsDisabled
return ErrAllComponentsDisabled
}

if !config.IsSet("api_key") {
Expand Down
Loading
Loading