From 436f40730e968d00c4e1b87d8f5a1fb283f23e61 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Fri, 11 Oct 2024 12:39:58 -0400 Subject: [PATCH 1/6] [OTEL-2125] Add E2E test for no dd exporter case --- .../otel/otel-agent/config/no-dd-exporter.yml | 23 +++++ .../tests/otel/otel-agent/minimal_test.go | 6 +- .../otel/otel-agent/no_dd_exporter_test.go | 59 ++++++++++++ .../testdata/no-dd-exporter-full-config.yml | 93 +++++++++++++++++++ .../no-dd-exporter-provided-config.yml | 49 ++++++++++ .../{minimal-sources.json => sources.json} | 0 test/new-e2e/tests/otel/utils/config_utils.go | 29 ++++-- 7 files changed, 249 insertions(+), 10 deletions(-) create mode 100644 test/new-e2e/tests/otel/otel-agent/config/no-dd-exporter.yml create mode 100644 test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go create mode 100644 test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml create mode 100644 test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml rename test/new-e2e/tests/otel/otel-agent/testdata/{minimal-sources.json => sources.json} (100%) diff --git a/test/new-e2e/tests/otel/otel-agent/config/no-dd-exporter.yml b/test/new-e2e/tests/otel/otel-agent/config/no-dd-exporter.yml new file mode 100644 index 0000000000000..b952fe8d38811 --- /dev/null +++ b/test/new-e2e/tests/otel/otel-agent/config/no-dd-exporter.yml @@ -0,0 +1,23 @@ +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 + +exporters: + debug: + verbosity: detailed + +service: + pipelines: + traces: + receivers: [otlp] + exporters: [debug] + metrics: + receivers: [otlp] + exporters: [debug] + logs: + receivers: [otlp] + exporters: [debug] diff --git a/test/new-e2e/tests/otel/otel-agent/minimal_test.go b/test/new-e2e/tests/otel/otel-agent/minimal_test.go index 9377c56fd514f..d0d1dbeb916ca 100644 --- a/test/new-e2e/tests/otel/otel-agent/minimal_test.go +++ b/test/new-e2e/tests/otel/otel-agent/minimal_test.go @@ -32,8 +32,8 @@ var minimalProvidedConfig string //go:embed testdata/minimal-full-config.yml var minimalFullConfig string -//go:embed testdata/minimal-sources.json -var minimalSources string +//go:embed testdata/sources.json +var sources string func TestOTelAgentMinimal(t *testing.T) { values := ` @@ -82,7 +82,7 @@ func (s *minimalTestSuite) TestOTelAgentInstalled() { } func (s *minimalTestSuite) TestOTelFlareExtensionResponse() { - utils.TestOTelFlareExtensionResponse(s, minimalProvidedConfig, minimalFullConfig, minimalSources) + utils.TestOTelFlareExtensionResponse(s, minimalProvidedConfig, minimalFullConfig, sources) } func (s *minimalTestSuite) TestOTelFlareFiles() { diff --git a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go new file mode 100644 index 0000000000000..98cfb251d7724 --- /dev/null +++ b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go @@ -0,0 +1,59 @@ +// 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 otelagent contains e2e otel agent tests +package otelagent + +import ( + _ "embed" + "testing" + + "github.com/DataDog/test-infra-definitions/components/datadog/kubernetesagentparams" + + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" + awskubernetes "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/kubernetes" + "github.com/DataDog/datadog-agent/test/new-e2e/tests/otel/utils" +) + +type noDDExporterTestSuite struct { + e2e.BaseSuite[environments.Kubernetes] +} + +//go:embed config/no-dd-exporter.yml +var noDDExporterConfig string + +//go:embed testdata/no-dd-exporter-provided-config.yml +var noDDExporterProvidedConfig string + +//go:embed testdata/no-dd-exporter-full-config.yml +var noDDExporterFullConfig string + +func TestOTelAgentWithNoDDExporter(t *testing.T) { + values := ` +datadog: + logs: + containerCollectAll: false + containerCollectUsingFiles: false +` + t.Parallel() + e2e.Run(t, &noDDExporterTestSuite{}, + e2e.WithProvisioner( + awskubernetes.KindProvisioner( + awskubernetes.WithAgentOptions( + kubernetesagentparams.WithoutDualShipping(), + kubernetesagentparams.WithHelmValues(values), + kubernetesagentparams.WithOTelAgent(), + kubernetesagentparams.WithOTelConfig(noDDExporterConfig), + )))) +} + +func (s *noDDExporterTestSuite) TestOTelAgentInstalled() { + utils.TestOTelAgentInstalled(s) +} + +func (s *noDDExporterTestSuite) TestOTelFlareExtensionResponse() { + utils.TestOTelFlareExtensionResponse(s, noDDExporterProvidedConfig, noDDExporterFullConfig, sources) +} diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml new file mode 100644 index 0000000000000..520d359737b52 --- /dev/null +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml @@ -0,0 +1,93 @@ +connectors: {} +exporters: + debug: + sampling_initial: 2 + sampling_thereafter: 1 + use_internal_logger: true + verbosity: Detailed +extensions: + ddflare/dd-autoconfigured: + auth: null + compression_algorithms: [] + cors: null + endpoint: localhost:7777 + include_metadata: false + max_request_body_size: 0 + response_headers: {} + tls: null + health_check/dd-autoconfigured: + auth: null + check_collector_pipeline: + enabled: false + exporter_failure_threshold: 5 + interval: 5m + compression_algorithms: [] + cors: null + endpoint: localhost:13133 + include_metadata: false + max_request_body_size: 0 + path: / + response_body: null + response_headers: {} + tls: null + pprof/dd-autoconfigured: + block_profile_fraction: 0 + dialer: + timeout: 0s + endpoint: localhost:1777 + mutex_profile_fraction: 0 + save_to_file: "" + zpages/dd-autoconfigured: + auth: null + compression_algorithms: [] + cors: null + endpoint: localhost:55679 + include_metadata: false + max_request_body_size: 0 + response_headers: {} + tls: null +processors: {} +receivers: + hostmetrics: + collection_interval: 1m0s + initial_delay: 1s + root_path: "" + timeout: 0s +service: + extensions: + - pprof/dd-autoconfigured + - zpages/dd-autoconfigured + - health_check/dd-autoconfigured + - ddflare/dd-autoconfigured + pipelines: + metrics/sys: + exporters: + - debug + processors: [] + receivers: + - hostmetrics + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + error_output_paths: + - stderr + initial_fields: {} + level: info + output_paths: + - stderr + sampling: + enabled: true + initial: 10 + thereafter: 100 + tick: 10s + metrics: + address: :8888 + level: Normal + readers: [] + resource: {} + traces: + processors: [] + propagators: [] diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml new file mode 100644 index 0000000000000..92a1a2aff55e7 --- /dev/null +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml @@ -0,0 +1,49 @@ +connectors: {} +exporters: + debug: + sampling_initial: 2 + sampling_thereafter: 1 + use_internal_logger: true + verbosity: Detailed +extensions: {} +processors: {} +receivers: + hostmetrics: + collection_interval: 1m0s + initial_delay: 1s + root_path: "" + timeout: 0s +service: + extensions: [] + pipelines: + metrics/sys: + exporters: + - debug + processors: [] + receivers: + - hostmetrics + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + error_output_paths: + - stderr + initial_fields: {} + level: info + output_paths: + - stderr + sampling: + enabled: true + initial: 10 + thereafter: 100 + tick: 10s + metrics: + address: :8888 + level: Normal + readers: [] + resource: {} + traces: + processors: [] + propagators: [] diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/minimal-sources.json b/test/new-e2e/tests/otel/otel-agent/testdata/sources.json similarity index 100% rename from test/new-e2e/tests/otel/otel-agent/testdata/minimal-sources.json rename to test/new-e2e/tests/otel/otel-agent/testdata/sources.json diff --git a/test/new-e2e/tests/otel/utils/config_utils.go b/test/new-e2e/tests/otel/utils/config_utils.go index ddee2793648fa..65fe605b0ea70 100644 --- a/test/new-e2e/tests/otel/utils/config_utils.go +++ b/test/new-e2e/tests/otel/utils/config_utils.go @@ -75,6 +75,19 @@ func TestOTelFlareExtensionResponse(s OTelTestSuite, providedCfg string, fullCfg err := s.Env().FakeIntake.Client().FlushServerAndResetAggregators() require.NoError(s.T(), err) agent := getAgentPod(s) + agentJSON, err := json.Marshal(agent) + require.NoError(s.T(), err) + s.T().Log("agent pod status ", string(agentJSON)) + + timeout := time.Now().Add(5 * time.Minute) + for i := 1; time.Now().Before(timeout); i++ { + stdout, stderr, err := s.Env().KubernetesCluster.KubernetesClient.PodExec("datadog", agent.Name, "otel-agent", []string{"curl", "localhost:13133"}) + s.T().Log("attempt ", i, " curl health check endpoint ", stdout, stderr, err) + if err == nil { + break + } + time.Sleep(30 * time.Second) + } s.T().Log("Starting flare") stdout, stderr, err := s.Env().KubernetesCluster.KubernetesClient.PodExec("datadog", agent.Name, "agent", []string{"agent", "flare", "--email", "e2e@test.com", "--send"}) @@ -211,13 +224,15 @@ func validateConfigs(t *testing.T, expectedCfg string, actualCfg string) { // Traces, metrics and logs endpoints are set dynamically to the fake intake address in the config // These endpoints vary from test to test and should be ignored in the comparison exps, _ := actualConfRaw["exporters"].(map[string]any) - ddExp, _ := exps["datadog"].(map[string]any) - tcfg := ddExp["traces"].(map[string]any) - delete(tcfg, "endpoint") - mcfg := ddExp["metrics"].(map[string]any) - delete(mcfg, "endpoint") - lcfg := ddExp["logs"].(map[string]any) - delete(lcfg, "endpoint") + if ddExp, ok := exps["datadog"]; ok { + ddExpCfg := ddExp.(map[string]any) + tcfg := ddExpCfg["traces"].(map[string]any) + delete(tcfg, "endpoint") + mcfg := ddExpCfg["metrics"].(map[string]any) + delete(mcfg, "endpoint") + lcfg := ddExpCfg["logs"].(map[string]any) + delete(lcfg, "endpoint") + } actualCfgBytes, err := yaml.Marshal(actualConfRaw) require.NoError(t, err) From 359bd70b73eb98d8861fd9824f8002114d4967ef Mon Sep 17 00:00:00 2001 From: Yang Song Date: Mon, 16 Dec 2024 15:48:34 -0500 Subject: [PATCH 2/6] try fix auth --- cmd/otel-agent/subcommands/run/command.go | 15 ++++++++++++++- comp/otelcol/ddflareextension/impl/server.go | 2 +- .../tests/otel/otel-agent/no_dd_exporter_test.go | 1 - 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cmd/otel-agent/subcommands/run/command.go b/cmd/otel-agent/subcommands/run/command.go index a414674620e44..08c1472998157 100644 --- a/cmd/otel-agent/subcommands/run/command.go +++ b/cmd/otel-agent/subcommands/run/command.go @@ -25,6 +25,7 @@ import ( "github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface" "github.com/DataDog/datadog-agent/comp/core/hostname/remotehostnameimpl" log "github.com/DataDog/datadog-agent/comp/core/log/def" + logfx "github.com/DataDog/datadog-agent/comp/core/log/fx" logtracefx "github.com/DataDog/datadog-agent/comp/core/log/fx-trace" "github.com/DataDog/datadog-agent/comp/core/secrets" tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def" @@ -106,8 +107,20 @@ func runOTelAgentCommand(ctx context.Context, params *subcommands.GlobalParams, fx.Provide(func() coreconfig.Component { return acfg }), + fx.Provide(func(_ coreconfig.Component) log.Params { + return log.ForDaemon(params.LoggerName, "log_file", pkgconfigsetup.DefaultOTelAgentLogFile) + }), + logfx.Module(), + fetchonlyimpl.Module(), + // TODO: don't rely on this pattern; remove this `OptionalModuleWithParams` thing + // and instead adapt OptionalModule to allow parameter passing naturally. + // See: https://github.com/DataDog/datadog-agent/pull/28386 + configsyncimpl.OptionalModuleWithParams(), + fx.Provide(func() configsyncimpl.Params { + return configsyncimpl.NewParams(params.SyncTimeout, params.SyncDelay, true) + }), converterfx.Module(), - fx.Provide(func(cp converter.Component) confmap.Converter { + fx.Provide(func(cp converter.Component, _ optional.Option[configsync.Component]) confmap.Converter { return cp }), collectorcontribFx.Module(), diff --git a/comp/otelcol/ddflareextension/impl/server.go b/comp/otelcol/ddflareextension/impl/server.go index ce1d2ceadef52..233dcddee1977 100644 --- a/comp/otelcol/ddflareextension/impl/server.go +++ b/comp/otelcol/ddflareextension/impl/server.go @@ -116,7 +116,7 @@ func newServer(endpoint string, handler http.Handler, auth bool) (*server, error // no easy way currently to pass required bearer auth token to OSS collector; // skip the validation if running inside a separate collector // TODO: determine way to allow OSS collector to authenticate with agent, OTEL-2226 - if auth { + if auth && util.GetAuthToken() != "" { r.Use(validateToken) } diff --git a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go index 98cfb251d7724..d9ef555e29204 100644 --- a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go +++ b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go @@ -43,7 +43,6 @@ datadog: e2e.WithProvisioner( awskubernetes.KindProvisioner( awskubernetes.WithAgentOptions( - kubernetesagentparams.WithoutDualShipping(), kubernetesagentparams.WithHelmValues(values), kubernetesagentparams.WithOTelAgent(), kubernetesagentparams.WithOTelConfig(noDDExporterConfig), From 38fd0b1f4e5061d8e58200816b6f97d05a6ff828 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Mon, 16 Dec 2024 18:53:50 -0500 Subject: [PATCH 3/6] fix configs --- .../testdata/no-dd-exporter-full-config.yml | 76 ++++++++++++++++--- .../no-dd-exporter-provided-config.yml | 66 +++++++++++++--- test/new-e2e/tests/otel/utils/config_utils.go | 16 +--- 3 files changed, 126 insertions(+), 32 deletions(-) diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml index 520d359737b52..82715115386ff 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml @@ -11,10 +11,14 @@ extensions: compression_algorithms: [] cors: null endpoint: localhost:7777 + idle_timeout: 0s include_metadata: false max_request_body_size: 0 + read_header_timeout: 0s + read_timeout: 0s response_headers: {} tls: null + write_timeout: 0s health_check/dd-autoconfigured: auth: null check_collector_pipeline: @@ -24,12 +28,16 @@ extensions: compression_algorithms: [] cors: null endpoint: localhost:13133 + idle_timeout: 0s include_metadata: false max_request_body_size: 0 path: / + read_header_timeout: 0s + read_timeout: 0s response_body: null response_headers: {} tls: null + write_timeout: 0s pprof/dd-autoconfigured: block_profile_fraction: 0 dialer: @@ -42,17 +50,47 @@ extensions: compression_algorithms: [] cors: null endpoint: localhost:55679 + idle_timeout: 0s include_metadata: false max_request_body_size: 0 + read_header_timeout: 0s + read_timeout: 0s response_headers: {} tls: null + write_timeout: 0s processors: {} receivers: - hostmetrics: - collection_interval: 1m0s - initial_delay: 1s - root_path: "" - timeout: 0s + otlp: + protocols: + grpc: + auth: null + dialer: + timeout: 0s + endpoint: 0.0.0.0:4317 + include_metadata: false + keepalive: null + max_concurrent_streams: 0 + max_recv_msg_size_mib: 0 + read_buffer_size: 524288 + tls: null + transport: tcp + write_buffer_size: 0 + http: + auth: null + compression_algorithms: [] + cors: null + endpoint: 0.0.0.0:4318 + idle_timeout: 0s + include_metadata: false + logs_url_path: /v1/logs + max_request_body_size: 0 + metrics_url_path: /v1/metrics + read_header_timeout: 0s + read_timeout: 0s + response_headers: {} + tls: null + traces_url_path: /v1/traces + write_timeout: 0s service: extensions: - pprof/dd-autoconfigured @@ -60,12 +98,24 @@ service: - health_check/dd-autoconfigured - ddflare/dd-autoconfigured pipelines: - metrics/sys: + logs: + exporters: + - debug + processors: [] + receivers: + - otlp + metrics: exporters: - debug processors: [] receivers: - - hostmetrics + - otlp + traces: + exporters: + - debug + processors: [] + receivers: + - otlp telemetry: logs: development: false @@ -78,16 +128,24 @@ service: level: info output_paths: - stderr + processors: [] sampling: enabled: true initial: 10 thereafter: 100 tick: 10s metrics: - address: :8888 + address: "" level: Normal - readers: [] + readers: + - pull: + exporter: + additionalproperties: null + prometheus: + host: localhost + port: 8888 resource: {} traces: + level: Basic processors: [] propagators: [] diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml index 92a1a2aff55e7..476cca27f17e6 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml @@ -8,20 +8,58 @@ exporters: extensions: {} processors: {} receivers: - hostmetrics: - collection_interval: 1m0s - initial_delay: 1s - root_path: "" - timeout: 0s + otlp: + protocols: + grpc: + auth: null + dialer: + timeout: 0s + endpoint: 0.0.0.0:4317 + include_metadata: false + keepalive: null + max_concurrent_streams: 0 + max_recv_msg_size_mib: 0 + read_buffer_size: 524288 + tls: null + transport: tcp + write_buffer_size: 0 + http: + auth: null + compression_algorithms: [] + cors: null + endpoint: 0.0.0.0:4318 + idle_timeout: 0s + include_metadata: false + logs_url_path: /v1/logs + max_request_body_size: 0 + metrics_url_path: /v1/metrics + read_header_timeout: 0s + read_timeout: 0s + response_headers: {} + tls: null + traces_url_path: /v1/traces + write_timeout: 0s service: extensions: [] pipelines: - metrics/sys: + logs: + exporters: + - debug + processors: [] + receivers: + - otlp + metrics: exporters: - debug processors: [] receivers: - - hostmetrics + - otlp + traces: + exporters: + - debug + processors: [] + receivers: + - otlp telemetry: logs: development: false @@ -34,16 +72,24 @@ service: level: info output_paths: - stderr + processors: [] sampling: enabled: true initial: 10 thereafter: 100 tick: 10s metrics: - address: :8888 + address: "" level: Normal - readers: [] + readers: + - pull: + exporter: + additionalproperties: null + prometheus: + host: localhost + port: 8888 resource: {} traces: + level: Basic processors: [] - propagators: [] + propagators: [] \ No newline at end of file diff --git a/test/new-e2e/tests/otel/utils/config_utils.go b/test/new-e2e/tests/otel/utils/config_utils.go index 65fe605b0ea70..0a5e41740fbbe 100644 --- a/test/new-e2e/tests/otel/utils/config_utils.go +++ b/test/new-e2e/tests/otel/utils/config_utils.go @@ -75,19 +75,6 @@ func TestOTelFlareExtensionResponse(s OTelTestSuite, providedCfg string, fullCfg err := s.Env().FakeIntake.Client().FlushServerAndResetAggregators() require.NoError(s.T(), err) agent := getAgentPod(s) - agentJSON, err := json.Marshal(agent) - require.NoError(s.T(), err) - s.T().Log("agent pod status ", string(agentJSON)) - - timeout := time.Now().Add(5 * time.Minute) - for i := 1; time.Now().Before(timeout); i++ { - stdout, stderr, err := s.Env().KubernetesCluster.KubernetesClient.PodExec("datadog", agent.Name, "otel-agent", []string{"curl", "localhost:13133"}) - s.T().Log("attempt ", i, " curl health check endpoint ", stdout, stderr, err) - if err == nil { - break - } - time.Sleep(30 * time.Second) - } s.T().Log("Starting flare") stdout, stderr, err := s.Env().KubernetesCluster.KubernetesClient.PodExec("datadog", agent.Name, "agent", []string{"agent", "flare", "--email", "e2e@test.com", "--send"}) @@ -107,6 +94,9 @@ func TestOTelFlareExtensionResponse(s OTelTestSuite, providedCfg string, fullCfg assert.Equal(s.T(), "Datadog Agent OpenTelemetry Collector", resp.AgentDesc) assert.Equal(s.T(), "", resp.RuntimeOverrideConfig) + s.T().Log("received provided config ", resp.CustomerConfig) + s.T().Log("received full config ", resp.RuntimeConfig) + validateConfigs(s.T(), providedCfg, resp.CustomerConfig) validateConfigs(s.T(), fullCfg, resp.RuntimeConfig) From 243a8072276f6977220d3a61d677ff66f855e0d1 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Mon, 16 Dec 2024 21:42:45 -0500 Subject: [PATCH 4/6] fix configs --- .../testdata/no-dd-exporter-full-config.yml | 133 ++++++++++++++++++ .../no-dd-exporter-provided-config.yml | 90 ++++++++++++ test/new-e2e/tests/otel/utils/config_utils.go | 3 - 3 files changed, 223 insertions(+), 3 deletions(-) diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml index 82715115386ff..e364c7d16b794 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml @@ -1,5 +1,97 @@ connectors: {} exporters: + datadog: + api: + fail_on_invalid_key: false + key: '[REDACTED]' + site: datadoghq.com + auth: null + compression: "" + cookies: null + disable_keep_alives: false + endpoint: "" + headers: {} + host_metadata: + enabled: false + hostname_source: config_or_system + reporter_period: 30m0s + tags: [] + hostname: "" + http2_ping_timeout: 0s + http2_read_idle_timeout: 0s + idle_conn_timeout: 1m30s + logs: + batch_wait: 5 + compression_level: 6 + dialer: + timeout: 0s + dump_payloads: false + endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com + use_compression: true + max_conns_per_host: 0 + max_idle_conns: 100 + max_idle_conns_per_host: 0 + metrics: + delta_ttl: 3600 + dialer: + timeout: 0s + endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com + histograms: + mode: distributions + send_aggregation_metrics: false + send_count_sum_metrics: false + instrumentation_scope_metadata_as_tags: false + resource_attributes_as_tags: false + summaries: + mode: gauges + sums: + cumulative_monotonic_mode: to_delta + initial_cumulative_monotonic_value: auto + only_metadata: false + proxy_url: "" + read_buffer_size: 0 + retry_on_failure: + enabled: true + initial_interval: 5s + max_elapsed_time: 5m0s + max_interval: 30s + multiplier: 1.5 + randomization_factor: 0.5 + sending_queue: + enabled: true + num_consumers: 10 + queue_size: 1000 + storage: null + timeout: 15s + tls: + ca_file: "" + ca_pem: '[REDACTED]' + cert_file: "" + cert_pem: '[REDACTED]' + cipher_suites: [] + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + key_pem: '[REDACTED]' + max_version: "" + min_version: "" + reload_interval: 0s + server_name_override: "" + traces: + compute_stats_by_span_kind: false + compute_top_level_by_span_kind: true + dialer: + timeout: 0s + endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com + ignore_resources: [] + peer_service_aggregation: false + peer_tags: [] + peer_tags_aggregation: false + span_name_as_resource_name: true + span_name_remappings: {} + trace_buffer: 0 + write_buffer_size: 0 debug: sampling_initial: 2 sampling_thereafter: 1 @@ -91,6 +183,41 @@ receivers: tls: null traces_url_path: /v1/traces write_timeout: 0s + prometheus/dd-autoconfigured: + config: + global: + evaluation_interval: 1m + scrape_interval: 1m + scrape_protocols: + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_timeout: 10s + runtime: + gogc: 75 + scrape_configs: + - enable_compression: true + enable_http2: true + follow_redirects: true + honor_timestamps: true + job_name: datadog-agent + metrics_path: /metrics + scheme: http + scrape_interval: 10s + scrape_protocols: + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_timeout: 10s + static_configs: + - targets: + - 0.0.0.0:8888 + track_timestamps_staleness: false + report_extra_scrape_metrics: false + start_time_metric_regex: "" + target_allocator: null + trim_metric_suffixes: false + use_start_time_metric: false service: extensions: - pprof/dd-autoconfigured @@ -110,6 +237,12 @@ service: processors: [] receivers: - otlp + metrics/dd-autoconfigured/datadog: + exporters: + - datadog + processors: [] + receivers: + - prometheus/dd-autoconfigured traces: exporters: - debug diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml index 476cca27f17e6..35e4da39fceb7 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml @@ -1,5 +1,95 @@ connectors: {} exporters: + datadog: + api: + fail_on_invalid_key: false + key: '[REDACTED]' + site: datadoghq.com + auth: null + compression: "" + cookies: null + disable_keep_alives: false + endpoint: "" + headers: {} + host_metadata: + enabled: false + hostname_source: config_or_system + reporter_period: 30m0s + tags: [] + hostname: "" + http2_ping_timeout: 0s + http2_read_idle_timeout: 0s + idle_conn_timeout: 1m30s + logs: + batch_wait: 5 + compression_level: 6 + dialer: + timeout: 0s + dump_payloads: false + use_compression: true + max_conns_per_host: 0 + max_idle_conns: 100 + max_idle_conns_per_host: 0 + metrics: + delta_ttl: 3600 + dialer: + timeout: 0s + histograms: + mode: distributions + send_aggregation_metrics: false + send_count_sum_metrics: false + instrumentation_scope_metadata_as_tags: false + resource_attributes_as_tags: false + summaries: + mode: gauges + sums: + cumulative_monotonic_mode: to_delta + initial_cumulative_monotonic_value: auto + only_metadata: false + proxy_url: "" + read_buffer_size: 0 + retry_on_failure: + enabled: true + initial_interval: 5s + max_elapsed_time: 5m0s + max_interval: 30s + multiplier: 1.5 + randomization_factor: 0.5 + sending_queue: + enabled: true + num_consumers: 10 + queue_size: 1000 + storage: null + timeout: 15s + tls: + ca_file: "" + ca_pem: '[REDACTED]' + cert_file: "" + cert_pem: '[REDACTED]' + cipher_suites: [] + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + key_pem: '[REDACTED]' + max_version: "" + min_version: "" + reload_interval: 0s + server_name_override: "" + traces: + compute_stats_by_span_kind: false + compute_top_level_by_span_kind: true + dialer: + timeout: 0s + endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com + ignore_resources: [] + peer_service_aggregation: false + peer_tags: [] + peer_tags_aggregation: false + span_name_as_resource_name: true + span_name_remappings: {} + trace_buffer: 0 + write_buffer_size: 0 debug: sampling_initial: 2 sampling_thereafter: 1 diff --git a/test/new-e2e/tests/otel/utils/config_utils.go b/test/new-e2e/tests/otel/utils/config_utils.go index 0a5e41740fbbe..3d10d5267bc2e 100644 --- a/test/new-e2e/tests/otel/utils/config_utils.go +++ b/test/new-e2e/tests/otel/utils/config_utils.go @@ -94,9 +94,6 @@ func TestOTelFlareExtensionResponse(s OTelTestSuite, providedCfg string, fullCfg assert.Equal(s.T(), "Datadog Agent OpenTelemetry Collector", resp.AgentDesc) assert.Equal(s.T(), "", resp.RuntimeOverrideConfig) - s.T().Log("received provided config ", resp.CustomerConfig) - s.T().Log("received full config ", resp.RuntimeConfig) - validateConfigs(s.T(), providedCfg, resp.CustomerConfig) validateConfigs(s.T(), fullCfg, resp.RuntimeConfig) From cecf50c688b33cb4fd1a61a929a3f78353be4f0a Mon Sep 17 00:00:00 2001 From: Yang Song Date: Tue, 17 Dec 2024 10:21:02 -0500 Subject: [PATCH 5/6] remove endpoints in config --- .../otel/otel-agent/testdata/no-dd-exporter-full-config.yml | 3 --- .../otel-agent/testdata/no-dd-exporter-provided-config.yml | 1 - 2 files changed, 4 deletions(-) diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml index e364c7d16b794..c6b9b49a44110 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml @@ -26,7 +26,6 @@ exporters: dialer: timeout: 0s dump_payloads: false - endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com use_compression: true max_conns_per_host: 0 max_idle_conns: 100 @@ -35,7 +34,6 @@ exporters: delta_ttl: 3600 dialer: timeout: 0s - endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com histograms: mode: distributions send_aggregation_metrics: false @@ -83,7 +81,6 @@ exporters: compute_top_level_by_span_kind: true dialer: timeout: 0s - endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com ignore_resources: [] peer_service_aggregation: false peer_tags: [] diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml index 35e4da39fceb7..6128f4ce1156e 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml @@ -81,7 +81,6 @@ exporters: compute_top_level_by_span_kind: true dialer: timeout: 0s - endpoint: https://5cc6b946943fbd35.lb3.fi.qa.dda-testing.com ignore_resources: [] peer_service_aggregation: false peer_tags: [] From ca211b534ed42aed3ada8765067211b5eb2277cd Mon Sep 17 00:00:00 2001 From: Yang Song Date: Wed, 18 Dec 2024 17:42:58 -0500 Subject: [PATCH 6/6] fix merge conflict --- .../otel/otel-agent/testdata/no-dd-exporter-full-config.yml | 2 +- .../otel/otel-agent/testdata/no-dd-exporter-provided-config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml index c6b9b49a44110..e0276e1bb2aa3 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-full-config.yml @@ -85,7 +85,7 @@ exporters: peer_service_aggregation: false peer_tags: [] peer_tags_aggregation: false - span_name_as_resource_name: true + span_name_as_resource_name: false span_name_remappings: {} trace_buffer: 0 write_buffer_size: 0 diff --git a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml index 6128f4ce1156e..b97863a32c71c 100644 --- a/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml +++ b/test/new-e2e/tests/otel/otel-agent/testdata/no-dd-exporter-provided-config.yml @@ -85,7 +85,7 @@ exporters: peer_service_aggregation: false peer_tags: [] peer_tags_aggregation: false - span_name_as_resource_name: true + span_name_as_resource_name: false span_name_remappings: {} trace_buffer: 0 write_buffer_size: 0