Skip to content

Commit b71df44

Browse files
authored
[exporter/datadog] use the same default batch configs as exporterhelper (#43848)
#### Description Set sending queue batch default values to match exporter helper default: flush timeout 200ms, min size 8192, no max size. Context: when we applied the default batch values in #43419 to datadog-agent, we observed a [regression](DataDog/datadog-agent#41661 (comment)) in performance tests. Setting the batch values back to batch processor default values (also the exporter helper default) fixes the regression, thus this change. A downside is if users ran into 413 payload too large errors, they now need to set the batch values in datadog::sending_queue::batch. This is reflected in the readme. #### Link to tracking issue related to #43082
1 parent 516505d commit b71df44

File tree

4 files changed

+38
-28
lines changed

4 files changed

+38
-28
lines changed

.chloggen/dd-exporter-queue.yaml

Lines changed: 27 additions & 0 deletions
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. receiver/filelog)
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: "Set sending queue batch default values to match exporter helper default: flush timeout 200ms, min size 8192, no max size."
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: [43848]
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: "The default values now match exactly the default in batch processor."
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/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ Find the full configs of Datadog exporter and their usage in [collector.yaml](./
2727

2828
This error indicates the payload size sent by the Datadog exporter exceeds the size limit (see previous examples https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16834, https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/17566).
2929

30-
This is usually caused by the pipeline batching too many telemetry data before sending to the Datadog API intake. To fix that, prefer using the Datadog exporter `sending_queue::batch` section instead of the batch processor, since the former has the defaults that work correctly with Datadog:
30+
This is usually caused by the pipeline batching too many telemetry data before sending to the Datadog API intake. To fix that, prefer using the Datadog exporter `sending_queue::batch` section instead of the batch processor:
3131

3232
```yaml
3333
exporters:
3434
datadog:
3535
api:
3636
key: ${env:DD_API_KEY}
3737
sending_queue:
38-
# An empty section means that the defaults will be used.
3938
batch:
39+
min_size: 10
40+
max_size: 100
41+
flush_timeout: 10s
4042
```
4143
4244

pkg/datadog/config/config.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"go.opentelemetry.io/collector/config/confighttp"
1616
"go.opentelemetry.io/collector/config/confignet"
1717
"go.opentelemetry.io/collector/config/configopaque"
18-
"go.opentelemetry.io/collector/config/configoptional"
1918
"go.opentelemetry.io/collector/config/configretry"
2019
"go.opentelemetry.io/collector/confmap"
2120
"go.opentelemetry.io/collector/exporter/exporterhelper"
@@ -344,31 +343,12 @@ func defaultClientConfig() confighttp.ClientConfig {
344343
return client
345344
}
346345

347-
// newDefaultQueueConfig creates the default exporter queue configuration.
348-
func newDefaultQueueConfig() exporterhelper.QueueBatchConfig {
349-
queueSet := exporterhelper.NewDefaultQueueConfig()
350-
// Override batching options since the defaults cause payloads that are over our limits
351-
// See e.g. https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16834 or https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/17566
352-
//
353-
// The limits were chosen based on the API intake limits:
354-
// - Trace intake: 3.2MB
355-
// - Log intake: https://docs.datadoghq.com/api/latest/logs/
356-
// - Metrics V2 intake: https://docs.datadoghq.com/api/latest/metrics/#submit-metrics
357-
queueSet.Batch = configoptional.Default(exporterhelper.BatchConfig{
358-
FlushTimeout: 10 * time.Second,
359-
Sizer: exporterhelper.RequestSizerTypeItems,
360-
MinSize: 10,
361-
MaxSize: 100,
362-
})
363-
return queueSet
364-
}
365-
366346
// CreateDefaultConfig creates the default exporter configuration
367347
func CreateDefaultConfig() component.Config {
368348
return &Config{
369349
ClientConfig: defaultClientConfig(),
370350
BackOffConfig: configretry.NewDefaultBackOffConfig(),
371-
QueueSettings: newDefaultQueueConfig(),
351+
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
372352

373353
API: APIConfig{
374354
Site: "datadoghq.com",

pkg/datadog/config/config_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"go.opentelemetry.io/collector/confmap"
2323
"go.opentelemetry.io/collector/confmap/confmaptest"
2424
"go.opentelemetry.io/collector/confmap/xconfmap"
25+
"go.opentelemetry.io/collector/exporter/exporterhelper"
2526
)
2627

2728
func TestValidate(t *testing.T) {
@@ -408,7 +409,7 @@ func TestCreateDefaultConfig(t *testing.T) {
408409
assert.Equal(t, &Config{
409410
ClientConfig: defaultClientConfig(),
410411
BackOffConfig: configretry.NewDefaultBackOffConfig(),
411-
QueueSettings: newDefaultQueueConfig(),
412+
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
412413

413414
API: APIConfig{
414415
Site: "datadoghq.com",
@@ -484,7 +485,7 @@ func TestLoadConfig(t *testing.T) {
484485
expected: &Config{
485486
ClientConfig: defaultClientConfig(),
486487
BackOffConfig: configretry.NewDefaultBackOffConfig(),
487-
QueueSettings: newDefaultQueueConfig(),
488+
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
488489
API: APIConfig{
489490
Key: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
490491
Site: "datadoghq.com",
@@ -545,7 +546,7 @@ func TestLoadConfig(t *testing.T) {
545546
expected: &Config{
546547
ClientConfig: defaultClientConfig(),
547548
BackOffConfig: configretry.NewDefaultBackOffConfig(),
548-
QueueSettings: newDefaultQueueConfig(),
549+
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
549550
TagsConfig: TagsConfig{
550551
Hostname: "customhostname",
551552
},
@@ -613,7 +614,7 @@ func TestLoadConfig(t *testing.T) {
613614
expected: &Config{
614615
ClientConfig: defaultClientConfig(),
615616
BackOffConfig: configretry.NewDefaultBackOffConfig(),
616-
QueueSettings: newDefaultQueueConfig(),
617+
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
617618
TagsConfig: TagsConfig{
618619
Hostname: "customhostname",
619620
},
@@ -679,7 +680,7 @@ func TestLoadConfig(t *testing.T) {
679680
expected: &Config{
680681
ClientConfig: defaultClientConfig(),
681682
BackOffConfig: configretry.NewDefaultBackOffConfig(),
682-
QueueSettings: newDefaultQueueConfig(),
683+
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
683684
API: APIConfig{
684685
Key: "abc",
685686
Site: "datadoghq.com",

0 commit comments

Comments
 (0)