diff --git a/src/Config/SDK/Configuration/ConfigurationFactory.php b/src/Config/SDK/Configuration/ConfigurationFactory.php index 66ce09c32..ae3fbb5eb 100644 --- a/src/Config/SDK/Configuration/ConfigurationFactory.php +++ b/src/Config/SDK/Configuration/ConfigurationFactory.php @@ -16,7 +16,6 @@ use OpenTelemetry\Config\SDK\Configuration\Internal\EnvSubstitutionNormalization; use OpenTelemetry\Config\SDK\Configuration\Internal\ResourceCollection; use OpenTelemetry\Config\SDK\Configuration\Internal\TrackingEnvReader; -use OpenTelemetry\Config\SDK\Configuration\Internal\TreatNullAsUnsetNormalization; use OpenTelemetry\Config\SDK\Configuration\Loader\YamlExtensionFileLoader; use OpenTelemetry\Config\SDK\Configuration\Loader\YamlSymfonyFileLoader; use function serialize; @@ -134,8 +133,6 @@ private function compileFactory(): CompiledConfigurationFactory $envReader = new TrackingEnvReader($this->envReader); // Parse MUST perform environment variable substitution. (new EnvSubstitutionNormalization($envReader))->apply($root); - // Parse MUST interpret null as equivalent to unset. - (new TreatNullAsUnsetNormalization())->apply($root); $node = $root->getNode(forceRootNode: true); diff --git a/tests/Integration/Config/configurations/kitchen-sink.yaml b/tests/Integration/Config/configurations/kitchen-sink.yaml index c1302a5b6..04809061e 100644 --- a/tests/Integration/Config/configurations/kitchen-sink.yaml +++ b/tests/Integration/Config/configurations/kitchen-sink.yaml @@ -80,7 +80,7 @@ logger_provider: # Configure exporter. exporter: # Configure exporter to be console. - console: {} + console: # Configure log record limits. See also attribute_limits. limits: # Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit. @@ -98,7 +98,7 @@ meter_provider: pull: # Configure exporter. exporter: - console: {} + console: # Configure metric producers. producers: - # Configure metric producer to be opencensus. @@ -162,7 +162,7 @@ meter_provider: # Configure exporter. exporter: # Configure exporter to be console. - console: {} + console: # Configure views. Each view has a selector which determines the instrument(s) it applies to, and a configuration for the resulting stream(s). views: - # Configure view selector. Selection criteria is additive as described in https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#instrument-selection-criteria. @@ -312,7 +312,7 @@ tracer_provider: # Configure exporter. exporter: # Configure exporter to be console. - console: {} + console: # Configure span limits. See also attribute_limits. limits: # Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit. @@ -348,24 +348,24 @@ tracer_provider: ratio: 0.0001 # Configure remote_parent_sampled sampler. # If omitted or null, always_on is used. - # remote_parent_sampled: - # # Configure sampler to be always_on. - # always_on: + remote_parent_sampled: + # Configure sampler to be always_on. + always_on: # Configure remote_parent_not_sampled sampler. # If omitted or null, always_off is used. - # remote_parent_not_sampled: - # # Configure sampler to be always_off. - # always_off: + remote_parent_not_sampled: + # Configure sampler to be always_off. + always_off: # Configure local_parent_sampled sampler. # If omitted or null, always_on is used. - # local_parent_sampled: - # # Configure sampler to be always_on. - # always_on: + local_parent_sampled: + # Configure sampler to be always_on. + always_on: # Configure local_parent_not_sampled sampler. # If omitted or null, always_off is used. - # local_parent_not_sampled: - # # Configure sampler to be always_off. - # always_off: + local_parent_not_sampled: + # Configure sampler to be always_off. + always_off: # Configure resource for all signals. # If omitted, the default resource is used. resource: diff --git a/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php b/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php index 04302026d..da705d392 100644 --- a/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php +++ b/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php @@ -126,8 +126,7 @@ public function getConfig(ComponentProviderRegistry $registry): ArrayNodeDefinit float_key: 1.1 # Interpreted as type float, tag URI tag:yaml.org,2002:float combo_string_key: foo value 1.1 # Interpreted as type string, tag URI tag:yaml.org,2002:str string_key_with_default: fallback # Interpreted as type string, tag URI tag:yaml.org,2002:str - # undefined_key removed as null is treated as unset - # undefined_key: # Interpreted as type null, tag URI tag:yaml.org,2002:null + undefined_key: # Interpreted as type null, tag URI tag:yaml.org,2002:null ${STRING_VALUE}: value # Interpreted as type string, tag URI tag:yaml.org,2002:str YAML), self::getPropertiesFromPlugin($parsed), @@ -167,19 +166,6 @@ public function test_env_substitution_non_string(): void $this->assertSame(2048, self::getPropertiesFromPlugin($parsed)['attribute_limits']['attribute_value_length_limit']); } - public function test_treat_null_as_unset(): void - { - $parsed = self::factory()->process([[ - 'file_format' => '0.1', - 'attribute_limits' => [ - 'attribute_count_limit' => null, - ], - ]]); - - $this->assertInstanceOf(ComponentPlugin::class, $parsed); - $this->assertSame(128, self::getPropertiesFromPlugin($parsed)['attribute_limits']['attribute_count_limit']); - } - /** * @psalm-suppress UndefinedThisPropertyFetch,PossiblyNullFunctionCall */