diff --git a/internal/settings/settings.go b/internal/settings/settings.go index d402ac8103..6c9a59e92e 100644 --- a/internal/settings/settings.go +++ b/internal/settings/settings.go @@ -78,7 +78,9 @@ var DefaultAgentConfigWindows = func() string { return filepath.Clean(path) }() -var defaultFeatureGates = []string{} +var defaultFeatureGates = []string{ + "-confmap.strictlyTypedInput", // TODO: Remove as part of OTL-2877 and after https://github.com/open-telemetry/opentelemetry-collector/issues/5228 +} type Settings struct { discovery *discovery.Provider diff --git a/internal/settings/settings_test.go b/internal/settings/settings_test.go index bf979d1940..43cd125ffc 100644 --- a/internal/settings/settings_test.go +++ b/internal/settings/settings_test.go @@ -132,7 +132,7 @@ func TestNewSettingsNoConvertConfig(t *testing.T) { "splunk.property:splunk.discovery.receiver.receiver-type/name.config.field.two=val.two", }, settings.ResolverURIs()) require.Equal(t, 2, len(settings.ConfMapConverterFactories())) - require.Equal(t, []string{"--feature-gates", "foo", "--feature-gates", "-bar"}, settings.ColCoreArgs()) + require.Equal(t, []string{"--feature-gates", "foo", "--feature-gates", "-bar", "--feature-gates", "-confmap.strictlyTypedInput"}, settings.ColCoreArgs()) } func TestNewSettingsConvertConfig(t *testing.T) { @@ -157,7 +157,7 @@ func TestNewSettingsConvertConfig(t *testing.T) { require.Equal(t, []string{configPath, anotherConfigPath}, settings.ResolverURIs()) require.Equal(t, 12, len(settings.ConfMapConverterFactories())) - require.Equal(t, []string{"--feature-gates", "foo", "--feature-gates", "-bar"}, settings.ColCoreArgs()) + require.Equal(t, []string{"--feature-gates", "foo", "--feature-gates", "-bar", "--feature-gates", "-confmap.strictlyTypedInput"}, settings.ColCoreArgs()) } func TestSplunkConfigYamlUtilizedInResolverURIs(t *testing.T) { @@ -184,7 +184,7 @@ func TestNewSettingsWithValidate(t *testing.T) { settings, err := New([]string{"validate"}) require.NoError(t, err) require.NotNil(t, settings) - require.Equal(t, []string{"validate"}, settings.ColCoreArgs()) + require.Equal(t, []string{"--feature-gates", "-confmap.strictlyTypedInput", "validate"}, settings.ColCoreArgs()) } func TestCheckRuntimeParams_Default(t *testing.T) { @@ -338,9 +338,9 @@ func TestSetDefaultEnvVarsSetsInterfaceFromConfigOption(t *testing.T) { func TestSetDefaultFeatureGatesRespectsOverrides(t *testing.T) { t.Cleanup(setRequiredEnvVars(t)) for _, args := range [][]string{ - {"--feature-gates", "some-gate", "--feature-gates", "telemetry.useOtelForInternalMetrics", "--feature-gates", "another-gate"}, - {"--feature-gates", "some-gate", "--feature-gates", "+telemetry.useOtelForInternalMetrics", "--feature-gates", "another-gate"}, - {"--feature-gates", "some-gate", "--feature-gates", "-telemetry.useOtelForInternalMetrics", "--feature-gates", "another-gate"}, + {"--feature-gates", "some-gate", "--feature-gates", "telemetry.useOtelForInternalMetrics", "--feature-gates", "another-gate", "--feature-gates", "+confmap.strictlyTypedInput"}, + {"--feature-gates", "some-gate", "--feature-gates", "+telemetry.useOtelForInternalMetrics", "--feature-gates", "another-gate", "--feature-gates", "+confmap.strictlyTypedInput"}, + {"--feature-gates", "some-gate", "--feature-gates", "-telemetry.useOtelForInternalMetrics", "--feature-gates", "another-gate", "--feature-gates", "+confmap.strictlyTypedInput"}, } { t.Run(strings.Join(args, " "), func(t *testing.T) { settings, err := New(args) diff --git a/tests/general/default_config_test.go b/tests/general/default_config_test.go index b5e0b6901a..89c0f1002f 100644 --- a/tests/general/default_config_test.go +++ b/tests/general/default_config_test.go @@ -110,7 +110,7 @@ func TestDefaultGatewayConfig(t *testing.T) { "batch": nil, "memory_limiter": map[string]any{ "check_interval": "2s", - "limit_mib": 460, + "limit_mib": "460", }, "resourcedetection/internal": map[string]any{ "detectors": []any{"gcp", "ecs", "ec2", "azure", "system"}, @@ -297,7 +297,7 @@ func TestDefaultAgentConfig(t *testing.T) { "batch": nil, "memory_limiter": map[string]any{ "check_interval": "2s", - "limit_mib": 460, + "limit_mib": "460", }, "resourcedetection": map[string]any{"detectors": []any{"gcp", "ecs", "ec2", "azure", "system"}, "override": true,