Files
59704dc34c [otelcol] Fix missing defaults in unredacted print-config (#14752)
**Description**

Fixes an issue where `otelcol print-config --mode=unredacted` omits
default values, causing its output structure to differ significantly
from `redacted` mode.

*Implementation details:*
This PR introduces a new `confmap.WithUnredacted()` `MarshalOption` and
an `unredactedStringer` interface within the `mapstructure` encoder.
This allows the configuration to be marshaled natively without
redaction, preserving all default values while cleanly decoupling the
encoder from `configopaque`. The previous recursive post-processing
workaround has been entirely removed.

**Link to tracking issue**

Fixes #14750

**Testing**

* Removed obsolete tests related to the recursive workaround.
* Updated `TestPrintCommand` in `command_print_test.go` to assert
default values are correctly handled natively in `unredacted` mode.
* Passed `make test` locally.

**Documentation**

* Added `.chloggen` entry.

---------

Signed-off-by: EdgeN8v <[email protected]>
Co-authored-by: Damien Mathieu <[email protected]>
Co-authored-by: Vihas Makwana <[email protected]>
Co-authored-by: Pablo Baeyens <[email protected]>
2026-04-06 12:26:57 +00:00

17 lines
375 B
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package internal // import "go.opentelemetry.io/collector/confmap/internal"
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestEncoderConfigUnredacted(t *testing.T) {
opts := MarshalOptions{OpaqueUnredacted: true}
cfg := EncoderConfig(nil, opts)
require.NotNil(t, cfg)
}