mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
**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]>
22 lines
419 B
Go
22 lines
419 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package xconfmap
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"go.opentelemetry.io/collector/confmap/internal"
|
|
)
|
|
|
|
func TestWithUnredacted(t *testing.T) {
|
|
opt := WithUnredacted()
|
|
require.NotNil(t, opt)
|
|
|
|
opts := &internal.MarshalOptions{}
|
|
opt.(internal.MarshalOptionFunc)(opts)
|
|
require.True(t, opts.OpaqueUnredacted)
|
|
}
|