Skip to content

Commit ebaf5cc

Browse files
liustanleymx-psi
andauthored
[exporter/datadog] Upgrade exporter.datadogexporter.UseLogsAgentExporter feature flag to beta (open-telemetry#34420)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Use Datadog Agent logs pipeline by default for exporting logs to Datadog. Upgrades `exporter.datadogexporter.UseLogsAgentExporter` feature flag to beta. Note: if users have `logs::dump_payloads` enabled in their config after upgrading, an error will be raised because this config option cannot be used with the logs agent exporter: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/f1aadc6c9c5d117eb61898cd2f1969a279a7f80e/exporter/datadogexporter/config.go#L658 **Link to tracking Issue:** <Issue number if applicable> Fixes open-telemetry#34366 and introduces general performance improvements. **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.> --------- Co-authored-by: Pablo Baeyens <[email protected]>
1 parent 1af1529 commit ebaf5cc

File tree

8 files changed

+75
-76
lines changed

8 files changed

+75
-76
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: exporter/datadog
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: The `logs::dump_payloads` config option is invalid when the Datadog Agent logs pipeline is enabled (now enabled by default).
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [34420]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
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.
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: exporter/datadog
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Use Datadog Agent logs pipeline by default for exporting logs to Datadog. Upgrades `exporter.datadogexporter.UseLogsAgentExporter` feature flag to beta.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [34420]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

exporter/datadogexporter/config.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -323,21 +323,21 @@ type LogsConfig struct {
323323
confignet.TCPAddrConfig `mapstructure:",squash"`
324324

325325
// DumpPayloads report whether payloads should be dumped when logging level is debug.
326-
// Note: this config option does not apply when enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
326+
// Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is enabled (now enabled by default).
327327
// Deprecated: This config option is not supported in the Datadog Agent logs pipeline.
328328
DumpPayloads bool `mapstructure:"dump_payloads"`
329329

330330
// UseCompression enables the logs agent to compress logs before sending them.
331-
// Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
331+
// Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled.
332332
UseCompression bool `mapstructure:"use_compression"`
333333

334334
// CompressionLevel accepts values from 0 (no compression) to 9 (maximum compression but higher resource usage).
335335
// Only takes effect if UseCompression is set to true.
336-
// Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
336+
// Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled.
337337
CompressionLevel int `mapstructure:"compression_level"`
338338

339339
// BatchWait represents the maximum time the logs agent waits to fill each batch of logs before sending.
340-
// Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
340+
// Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled.
341341
BatchWait int `mapstructure:"batch_wait"`
342342
}
343343

exporter/datadogexporter/examples/collector.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -457,28 +457,28 @@ exporters:
457457
## If set to true, payloads will be dumped when logging level is set to debug. Please note that
458458
## This may result in an escaping loop if a filelog receiver is watching the collector log output.
459459
## See: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16380
460-
## Note: this config option does not apply when enabling `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
460+
## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is enabled (now enabled by default).
461461
#
462462
# dump_payloads: false
463463

464464
## @param use_compression - boolean - optional - default: true
465465
## This parameter is available when sending logs with HTTPS. If enabled, the logs agent
466466
## compresses logs before sending them.
467-
## Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
467+
## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled.
468468
#
469469
# use_compression: true
470470

471471
## @param compression_level - integer - optional - default: 6
472472
## The compression_level parameter accepts values from 0 (no compression)
473473
## to 9 (maximum compression but higher resource usage). Only takes effect if
474474
## `use_compression` is set to `true`.
475-
## Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
475+
## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled.
476476
#
477477
# compression_level: 6
478478

479479
## @param batch_wait - integer - optional - default: 5
480480
## The maximum time the logs agent waits to fill each batch of logs before sending.
481-
## Note: this config option does not apply unless enabling the `exporter.datadogexporter.UseLogsAgentExporter` feature flag.
481+
## Note: this config option does not apply when the `exporter.datadogexporter.UseLogsAgentExporter` feature flag is disabled.
482482
#
483483
# batch_wait: 5
484484

exporter/datadogexporter/factory.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242

4343
var logsAgentExporterFeatureGate = featuregate.GlobalRegistry().MustRegister(
4444
"exporter.datadogexporter.UseLogsAgentExporter",
45-
featuregate.StageAlpha,
45+
featuregate.StageBeta,
4646
featuregate.WithRegisterDescription("When enabled, datadogexporter uses the Datadog agent logs pipeline for exporting logs."),
4747
featuregate.WithRegisterFromVersion("v0.100.0"),
4848
)

exporter/datadogexporter/factory_test.go

+8-61
Original file line numberDiff line numberDiff line change
@@ -123,67 +123,6 @@ func TestCreateDefaultConfig(t *testing.T) {
123123
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
124124
}
125125

126-
// Test that the factory creates the default configuration
127-
func TestCreateDefaultConfigLogsAgent(t *testing.T) {
128-
err := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true)
129-
assert.NoError(t, err)
130-
factory := NewFactory()
131-
cfg := factory.CreateDefaultConfig()
132-
133-
assert.Equal(t, &Config{
134-
ClientConfig: defaultClientConfig(),
135-
BackOffConfig: configretry.NewDefaultBackOffConfig(),
136-
QueueSettings: exporterhelper.NewDefaultQueueSettings(),
137-
138-
API: APIConfig{
139-
Site: "datadoghq.com",
140-
},
141-
142-
Metrics: MetricsConfig{
143-
TCPAddrConfig: confignet.TCPAddrConfig{
144-
Endpoint: "https://api.datadoghq.com",
145-
},
146-
DeltaTTL: 3600,
147-
HistConfig: HistogramConfig{
148-
Mode: "distributions",
149-
SendAggregations: false,
150-
},
151-
SumConfig: SumConfig{
152-
CumulativeMonotonicMode: CumulativeMonotonicSumModeToDelta,
153-
InitialCumulativeMonotonicMode: InitialValueModeAuto,
154-
},
155-
SummaryConfig: SummaryConfig{
156-
Mode: SummaryModeGauges,
157-
},
158-
},
159-
160-
Traces: TracesConfig{
161-
TCPAddrConfig: confignet.TCPAddrConfig{
162-
Endpoint: "https://trace.agent.datadoghq.com",
163-
},
164-
IgnoreResources: []string{},
165-
},
166-
Logs: LogsConfig{
167-
TCPAddrConfig: confignet.TCPAddrConfig{
168-
Endpoint: "https://http-intake.logs.datadoghq.com",
169-
},
170-
UseCompression: true,
171-
CompressionLevel: 6,
172-
BatchWait: 5,
173-
},
174-
175-
HostMetadata: HostMetadataConfig{
176-
Enabled: true,
177-
HostnameSource: HostnameSourceConfigOrSystem,
178-
},
179-
OnlyMetadata: false,
180-
}, cfg, "failed to create default config")
181-
182-
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
183-
err = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false)
184-
assert.NoError(t, err)
185-
}
186-
187126
func TestLoadConfig(t *testing.T) {
188127
t.Parallel()
189128

@@ -500,6 +439,8 @@ func TestCreateAPIMetricsExporter(t *testing.T) {
500439
}
501440

502441
func TestCreateAPIExporterFailOnInvalidKey_Zorkian(t *testing.T) {
442+
featuregateErr := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false)
443+
assert.NoError(t, featuregateErr)
503444
server := testutil.DatadogServerMock(testutil.ValidateAPIKeyEndpointInvalid)
504445
defer server.Close()
505446

@@ -577,9 +518,13 @@ func TestCreateAPIExporterFailOnInvalidKey_Zorkian(t *testing.T) {
577518
assert.NoError(t, err)
578519
assert.NotNil(t, lexp)
579520
})
521+
featuregateErr = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true)
522+
assert.NoError(t, featuregateErr)
580523
}
581524

582525
func TestCreateAPIExporterFailOnInvalidKey(t *testing.T) {
526+
featuregateErr := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false)
527+
assert.NoError(t, featuregateErr)
583528
server := testutil.DatadogServerMock(testutil.ValidateAPIKeyEndpointInvalid)
584529
defer server.Close()
585530

@@ -657,6 +602,8 @@ func TestCreateAPIExporterFailOnInvalidKey(t *testing.T) {
657602
assert.NoError(t, err)
658603
assert.NotNil(t, lexp)
659604
})
605+
featuregateErr = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true)
606+
assert.NoError(t, featuregateErr)
660607
}
661608

662609
func TestCreateAPILogsExporter(t *testing.T) {

exporter/datadogexporter/integrationtest/integration_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,6 @@ func TestIntegrationLogs(t *testing.T) {
466466
t.Setenv("SERVER_URL", server.URL)
467467

468468
// 2. Start in-process collector
469-
assert.NoError(t, featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true))
470-
defer func() {
471-
assert.NoError(t, featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false))
472-
}()
473469
factories := getIntegrationTestComponents(t)
474470
app := getIntegrationTestCollector(t, "integration_test_logs_config.yaml", factories)
475471
go func() {

exporter/datadogexporter/logs_exporter_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ func TestLogsExporter(t *testing.T) {
212212
},
213213
},
214214
}
215+
featuregateErr := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", false)
216+
assert.NoError(t, featuregateErr)
215217
for _, tt := range tests {
216218
t.Run(tt.name, func(t *testing.T) {
217219
server := testutil.DatadogLogServerMock()
@@ -238,6 +240,8 @@ func TestLogsExporter(t *testing.T) {
238240
assert.Equal(t, tt.want, server.LogsData)
239241
})
240242
}
243+
featuregateErr = featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true)
244+
assert.NoError(t, featuregateErr)
241245
}
242246

243247
func TestLogsAgentExporter(t *testing.T) {
@@ -497,8 +501,6 @@ func TestLogsAgentExporter(t *testing.T) {
497501
},
498502
},
499503
}
500-
err := featuregate.GlobalRegistry().Set("exporter.datadogexporter.UseLogsAgentExporter", true)
501-
assert.NoError(t, err)
502504
for _, tt := range tests {
503505
t.Run(tt.name, func(t *testing.T) {
504506
doneChannel := make(chan bool)

0 commit comments

Comments
 (0)