Skip to content

OTel Components: Wrapped config should start from OTel Defaults #6866

Description

@kgeckhart

Component(s)

Most OTel Collector components

Add a description

In the last two upgrades it was noted that most OTel components we wrap start from a "zero" config with no defaults applied. This can cause problems during upgrades when new fields are introduced and instead of us inheriting an upstream default we inject a "zero" value resulting in unexpected behavior.

We should invert all of these so that we start from upstream defaults and override based on our exposed configuration. Doing this isn't a small task I did use AI to research and group these for us to start,

Group 1: pure no-ops (7)

Upstream createDefaultConfig returns &Config{}, so seeding changes nothing. No goldens move. Cheapest way to establish the pattern.

Component Convert()
otelcol.auth.basic auth/basic/basic.go:112
otelcol.auth.headers auth/headers/headers.go:50
otelcol.auth.sigv4 auth/sigv4/sigv4.go:46
otelcol.processor.attributes processor/attributes/attributes.go:62
otelcol.processor.redaction processor/redaction/redaction.go:157
otelcol.processor.span processor/span/span.go:81
otelcol.receiver.fluentforward receiver/fluentforward/fluentforward.go:63

Group 2: one-line seed (7)

Already build into a named var, so the fix is one line at the top.

mapstructure.Decode into a zero struct, identical shape to the #6842 k8sattributes fix:

Component Convert()
otelcol.exporter.kafka exporter/kafka/kafka.go:276
otelcol.receiver.kafka receiver/kafka/kafka.go:207
otelcol.receiver.vcenter receiver/vcenter/vcenter.go:404

var result X.Config + field assignment:

Component Convert() Note
otelcol.exporter.googlecloud exporter/googlecloud/googlecloud.go:66 half-done: seeds embedded collector.DefaultConfig() and hardcodes the factory's 12s timeout, but never calls the exporter factory default
otelcol.exporter.googlecloudpubsub exporter/googlecloudpubsub/googlecloudpubsub.go:71
otelcol.processor.cumulativetodelta processor/cumulativetodelta/cumulativetodelta.go:109
otelcol.receiver.file_stats receiver/file_stats/types_convert.go:18

Group 3: small struct literals (19)

Flat upstream configs, 4 or fewer default fields. Batchable 4-6 per PR by kind.

Component Convert()
otelcol.auth.bearer auth/bearer/bearer.go:64
otelcol.auth.google auth/google/google.go:81
otelcol.connector.signaltometrics connector/signaltometrics/signaltometrics.go:75
otelcol.exporter.faro exporter/faro/faro.go:48
otelcol.exporter.loadbalancing exporter/loadbalancing/loadbalancing.go:123
otelcol.exporter.otlp exporter/otlp/otlp.go:62
otelcol.exporter.otlphttp exporter/otlphttp/otlphttp.go:73
otelcol.processor.batch processor/batch/batch.go:74
otelcol.processor.deltatocumulative processor/deltatocumulative/deltatocumulative.go:79
otelcol.processor.groupbyattrs processor/groupbyattrs/groupbyattrs.go:59
otelcol.processor.interval processor/interval/interval.go:79
otelcol.processor.metric_start_time processor/metricstarttime/metricstarttime.go:85
otelcol.processor.probabilistic_sampler processor/probabilistic_sampler/probabilistic_sampler.go:78
otelcol.receiver.awsecscontainermetrics receiver/awsecscontainermetrics/awsecscontainermetrics.go:52
otelcol.receiver.cloudflare receiver/cloudflare/cloudflare.go:77
otelcol.receiver.faro receiver/faro/faro.go:57
otelcol.receiver.googlecloudpubsub receiver/googlecloudpubsub/googlecloudpubsub.go:98
otelcol.receiver.influxdb receiver/influxdb/influxdb.go:63
otelcol.receiver.zipkin receiver/zipkin/zipkin.go:58

Group 4: large / nested struct literals (13)

configoptional wrappers, pointer sub-structs, feature-gate-dependent values, side-effecting default helpers. One PR each.

Component Convert() Landmine
otelcol.connector.count connector/count/count.go:119
otelcol.connector.servicegraph connector/servicegraph/servicegraph.go:151
otelcol.connector.spanmetrics connector/spanmetrics/spanmetrics.go:190 Histogram unit default reads a feature gate
otelcol.exporter.datadog exporter/datadog/datadog.go:89 default is datadogconfig.CreateDefaultConfig(), deeply nested
otelcol.exporter.file exporter/file/file.go:138 Rotation / GroupBy pointer sub-structs
otelcol.exporter.splunkhec exporter/splunkhec/config/splunkhec.go:266 20 default fields
otelcol.exporter.syslog exporter/syslog/syslog.go:72
otelcol.extension.jaeger_remote_sampling extension/jaeger_remote_sampling/jaeger_remote_sampling.go:82 vendored in-tree copy, so the factory is ours
otelcol.receiver.datadog receiver/datadog/datadog.go:119 nested Intake / Proxy
otelcol.receiver.jaeger receiver/jaeger/jaeger.go:68 protocols wrapped in configoptional
otelcol.receiver.otlp receiver/otlp/otlp.go:87 protocols wrapped in configoptional
otelcol.receiver.solace receiver/solace/solace.go:129 Flow wrapped in configoptional
otelcol.storage.file storage/file/file.go:199 default calls getDefaultDirectory()

Group 5: behavior fixes (6)

Upstream default sets a non-zero field that Alloy never assigns and doesn't expose, so these already run differently from the collector. Each needs a release note. Two of them need a new Alloy argument, not just a seeded default.

Component Convert() Divergence
otelcol.exporter.awss3 exporter/awss3/awss3.go:76 BackOffConfig zero-valued vs configretry.NewDefaultBackOffConfig(); no retry_on_failure block exists
otelcol.exporter.debug exporter/debug/debug.go:76 QueueConfig zero-valued vs configoptional.Default(NewDefaultQueueConfig()); no sending_queue block exists
otelcol.processor.memory_limiter processor/memorylimiter/memorylimiter.go:101 MinGCIntervalWhenSoftLimited is 0 vs 10s
otelcol.processor.resourcedetection processor/resourcedetection/resourcedetection.go:281 ClientConfig never referenced anywhere in the component vs defaultClientConfig()
otelcol.receiver.splunkhec receiver/splunkhec/splunkhec.go:135 Ack.Path is "" vs /services/collector/ack
otelcol.receiver.awscloudwatch receiver/awscloudwatch/awscloudwatch.go:66 whole Metrics block zeroed (ControllerConfig, Period, Delay). Confirm inert before writing up: Alloy only exposes logs

Tip

React with 👍 if this issue is important to you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions