diff --git a/.chloggen/stanley.liu_logs-agent-beta-breaking.yaml b/.chloggen/stanley.liu_logs-agent-beta-breaking.yaml new file mode 100644 index 000000000000..72f29cc76e0f --- /dev/null +++ b/.chloggen/stanley.liu_logs-agent-beta-breaking.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: exporter/datadog + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: The `logs::dump_payloads` config option is invalid when the Datadog Agent logs pipeline is enabled (now enabled by default). + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34420] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: An error will be raised if `logs::dump_payloads` is set while the Datadog Agent logs pipeline is enabled. To avoid this error, remove the `logs::dump_payloads` config option or temporarily disable the `exporter.datadogexporter.UseLogsAgentExporter` feature gate. + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/.chloggen/stanley.liu_logs-agent-beta.yaml b/.chloggen/stanley.liu_logs-agent-beta.yaml new file mode 100644 index 000000000000..6947ac54dd04 --- /dev/null +++ b/.chloggen/stanley.liu_logs-agent-beta.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: exporter/datadog + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Use Datadog Agent logs pipeline by default for exporting logs to Datadog. Upgrades `exporter.datadogexporter.UseLogsAgentExporter` feature flag to beta. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34420] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/exporter/datadogexporter/config.go b/exporter/datadogexporter/config.go index d61e837170e9..251c4fc84559 100644 --- a/exporter/datadogexporter/config.go +++ b/exporter/datadogexporter/config.go @@ -323,21 +323,21 @@ type LogsConfig struct { confignet.TCPAddrConfig `mapstructure:",squash"` // DumpPayloads report whether payloads should be dumped when logging level is debug. - // Note: this config option does not apply when enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + // Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is enabled (now enabled by default). // Deprecated: This config option is not supported in the Datadog Agent logs pipeline. DumpPayloads bool `mapstructure:"dump_payloads"` // UseCompression enables the logs agent to compress logs before sending them. - // Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + // Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled. UseCompression bool `mapstructure:"use_compression"` // CompressionLevel accepts values from 0 (no compression) to 9 (maximum compression but higher resource usage). // Only takes effect if UseCompression is set to true. - // Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + // Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled. CompressionLevel int `mapstructure:"compression_level"` // BatchWait represents the maximum time the logs agent waits to fill each batch of logs before sending. - // Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + // Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled. BatchWait int `mapstructure:"batch_wait"` } diff --git a/exporter/datadogexporter/examples/collector.yaml b/exporter/datadogexporter/examples/collector.yaml index 594c1083cdf1..669ad7d7872e 100644 --- a/exporter/datadogexporter/examples/collector.yaml +++ b/exporter/datadogexporter/examples/collector.yaml @@ -457,14 +457,14 @@ exporters: ## If set to true, payloads will be dumped when logging level is set to debug. Please note that ## This may result in an escaping loop if a filelog receiver is watching the collector log output. ## See: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16380 - ## Note: this config option does not apply when enabling `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + ## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is enabled (now enabled by default). # # dump_payloads: false ## @param use_compression - boolean - optional - default: true ## This parameter is available when sending logs with HTTPS. If enabled, the logs agent ## compresses logs before sending them. - ## Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + ## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled. # # use_compression: true @@ -472,13 +472,13 @@ exporters: ## The compression_level parameter accepts values from 0 (no compression) ## to 9 (maximum compression but higher resource usage). Only takes effect if ## `use_compression` is set to `true`. - ## Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + ## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled. # # compression_level: 6 ## @param batch_wait - integer - optional - default: 5 ## The maximum time the logs agent waits to fill each batch of logs before sending. - ## Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag. + ## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled. # # batch_wait: 5 diff --git a/exporter/datadogexporter/factory.go b/exporter/datadogexporter/factory.go index fa6a6957c0e2..dd6acd25ce99 100644 --- a/exporter/datadogexporter/factory.go +++ b/exporter/datadogexporter/factory.go @@ -42,7 +42,7 @@ import ( var logsAgentExporterFeatureGate = featuregate.GlobalRegistry().MustRegister( "exporter.datadogexporter.UseLogsAgentExporter", - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("When enabled, datadogexporter uses the Datadog agent logs pipeline for exporting logs."), featuregate.WithRegisterFromVersion("v0.100.0"), ) diff --git a/exporter/datadogexporter/factory_test.go b/exporter/datadogexporter/factory_test.go index e8caabc68e79..c0fa7d9f2251 100644 --- a/exporter/datadogexporter/factory_test.go +++ b/exporter/datadogexporter/factory_test.go @@ -123,67 +123,6 @@ func TestCreateDefaultConfig(t *testing.T) { assert.NoError(t, componenttest.CheckConfigStruct(cfg)) } -// Test that the factory creates the default configuration -func TestCreateDefaultConfigLogsAgent(t *testing.T) { - err := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true) - assert.NoError(t, err) - factory := NewFactory() - cfg := factory.CreateDefaultConfig() - - assert.Equal(t, &Config{ - ClientConfig: defaultClientConfig(), - BackOffConfig: configretry.NewDefaultBackOffConfig(), - QueueSettings: exporterhelper.NewDefaultQueueSettings(), - - API: APIConfig{ - Site: "datadoghq.com", - }, - - Metrics: MetricsConfig{ - TCPAddrConfig: confignet.TCPAddrConfig{ - Endpoint: "https://api.datadoghq.com", - }, - DeltaTTL: 3600, - HistConfig: HistogramConfig{ - Mode: "distributions", - SendAggregations: false, - }, - SumConfig: SumConfig{ - CumulativeMonotonicMode: CumulativeMonotonicSumModeToDelta, - InitialCumulativeMonotonicMode: InitialValueModeAuto, - }, - SummaryConfig: SummaryConfig{ - Mode: SummaryModeGauges, - }, - }, - - Traces: TracesConfig{ - TCPAddrConfig: confignet.TCPAddrConfig{ - Endpoint: "https://trace.agent.datadoghq.com", - }, - IgnoreResources: []string{}, - }, - Logs: LogsConfig{ - TCPAddrConfig: confignet.TCPAddrConfig{ - Endpoint: "https://http-intake.logs.datadoghq.com", - }, - UseCompression: true, - CompressionLevel: 6, - BatchWait: 5, - }, - - HostMetadata: HostMetadataConfig{ - Enabled: true, - HostnameSource: HostnameSourceConfigOrSystem, - }, - OnlyMetadata: false, - }, cfg, "failed to create default config") - - assert.NoError(t, componenttest.CheckConfigStruct(cfg)) - err = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false) - assert.NoError(t, err) -} - func TestLoadConfig(t *testing.T) { t.Parallel() @@ -500,6 +439,8 @@ func TestCreateAPIMetricsExporter(t *testing.T) { } func TestCreateAPIExporterFailOnInvalidKey_Zorkian(t *testing.T) { + featuregateErr := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false) + assert.NoError(t, featuregateErr) server := testutil.DatadogServerMock(testutil.ValidateAPIKeyEndpointInvalid) defer server.Close() @@ -577,9 +518,13 @@ func TestCreateAPIExporterFailOnInvalidKey_Zorkian(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, lexp) }) + featuregateErr = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true) + assert.NoError(t, featuregateErr) } func TestCreateAPIExporterFailOnInvalidKey(t *testing.T) { + featuregateErr := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false) + assert.NoError(t, featuregateErr) server := testutil.DatadogServerMock(testutil.ValidateAPIKeyEndpointInvalid) defer server.Close() @@ -657,6 +602,8 @@ func TestCreateAPIExporterFailOnInvalidKey(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, lexp) }) + featuregateErr = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true) + assert.NoError(t, featuregateErr) } func TestCreateAPILogsExporter(t *testing.T) { diff --git a/exporter/datadogexporter/integrationtest/integration_test.go b/exporter/datadogexporter/integrationtest/integration_test.go index f7082685ecb0..d1b8c92a119e 100644 --- a/exporter/datadogexporter/integrationtest/integration_test.go +++ b/exporter/datadogexporter/integrationtest/integration_test.go @@ -466,10 +466,6 @@ func TestIntegrationLogs(t *testing.T) { t.Setenv("SERVER_URL", server.URL) // 2. Start in-process collector - assert.NoError(t, featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true)) - defer func() { - assert.NoError(t, featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false)) - }() factories := getIntegrationTestComponents(t) app := getIntegrationTestCollector(t, "integration_test_logs_config.yaml", factories) go func() { diff --git a/exporter/datadogexporter/logs_exporter_test.go b/exporter/datadogexporter/logs_exporter_test.go index 93543b69a078..6c8c1aa92b5b 100644 --- a/exporter/datadogexporter/logs_exporter_test.go +++ b/exporter/datadogexporter/logs_exporter_test.go @@ -212,6 +212,8 @@ func TestLogsExporter(t *testing.T) { }, }, } + featuregateErr := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false) + assert.NoError(t, featuregateErr) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { server := testutil.DatadogLogServerMock() @@ -238,6 +240,8 @@ func TestLogsExporter(t *testing.T) { assert.Equal(t, tt.want, server.LogsData) }) } + featuregateErr = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true) + assert.NoError(t, featuregateErr) } func TestLogsAgentExporter(t *testing.T) { @@ -497,8 +501,6 @@ func TestLogsAgentExporter(t *testing.T) { }, }, } - err := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true) - assert.NoError(t, err) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { doneChannel := make(chan bool)