diff --git a/CHANGELOG.md b/CHANGELOG.md index 55e98384..39b14629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Add support for tracing of the Symfony HTTP client requests (#606) - Support logging the impersonator user, if any (#647) - ref: Use constant for the SDK version (#662) +- Add support for HTTP Client baggage propagation (#663) ## 4.3.1 (2022-10-10) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 05d06550..b1c1bdf3 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -48,6 +48,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->arrayNode('options') ->addDefaultsIfNotSet() ->fixXmlConfig('integration') + ->fixXmlConfig('trace_propagation_target') ->fixXmlConfig('tag') ->fixXmlConfig('class_serializer') ->fixXmlConfig('prefix', 'prefixes') @@ -72,6 +73,10 @@ public function getConfigTreeBuilder(): TreeBuilder ->info('The sampling factor to apply to transactions. A value of 0 will deny sending any transaction, and a value of 1 will send all transactions.') ->end() ->scalarNode('traces_sampler')->end() + ->arrayNode('trace_propagation_targets') + ->scalarPrototype()->end() + ->beforeNormalization()->castToArray()->end() + ->end() ->booleanNode('attach_stacktrace')->end() ->integerNode('context_lines')->min(0)->end() ->booleanNode('enable_compression')->end() diff --git a/src/Resources/config/schema/sentry-1.0.xsd b/src/Resources/config/schema/sentry-1.0.xsd index 9240c5c6..a140d46c 100644 --- a/src/Resources/config/schema/sentry-1.0.xsd +++ b/src/Resources/config/schema/sentry-1.0.xsd @@ -23,6 +23,7 @@ + diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 9b853130..76aaeaf8 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -26,6 +26,7 @@ public function testProcessConfigurationWithDefaultConfiguration(): void 'options' => [ 'integrations' => [], 'prefixes' => array_merge(['%kernel.project_dir%'], array_filter(explode(\PATH_SEPARATOR, get_include_path() ?: ''))), + 'trace_propagation_targets' => [], 'environment' => '%kernel.environment%', 'release' => PrettyVersions::getRootPackageVersion()->getPrettyVersion(), 'tags' => [], diff --git a/tests/DependencyInjection/Fixtures/php/full.php b/tests/DependencyInjection/Fixtures/php/full.php index 82c71ef8..cf52ebf9 100644 --- a/tests/DependencyInjection/Fixtures/php/full.php +++ b/tests/DependencyInjection/Fixtures/php/full.php @@ -17,6 +17,7 @@ 'sample_rate' => 1, 'traces_sample_rate' => 1, 'traces_sampler' => 'App\\Sentry\\Tracing\\TracesSampler', + 'trace_propagation_targets' => ['website.invalid'], 'attach_stacktrace' => true, 'context_lines' => 0, 'enable_compression' => true, diff --git a/tests/DependencyInjection/Fixtures/xml/full.xml b/tests/DependencyInjection/Fixtures/xml/full.xml index e9240f89..bab488bb 100644 --- a/tests/DependencyInjection/Fixtures/xml/full.xml +++ b/tests/DependencyInjection/Fixtures/xml/full.xml @@ -36,6 +36,7 @@ max-request-body-size="none" > App\Sentry\Integration\FooIntegration + website.invalid %kernel.project_dir% development %kernel.cache_dir% diff --git a/tests/DependencyInjection/Fixtures/yml/full.yml b/tests/DependencyInjection/Fixtures/yml/full.yml index e3c86290..d0799679 100644 --- a/tests/DependencyInjection/Fixtures/yml/full.yml +++ b/tests/DependencyInjection/Fixtures/yml/full.yml @@ -12,6 +12,8 @@ sentry: sample_rate: 1 traces_sample_rate: 1 traces_sampler: App\Sentry\Tracing\TracesSampler + trace_propagation_targets: + - 'website.invalid' attach_stacktrace: true context_lines: 0 enable_compression: true diff --git a/tests/DependencyInjection/SentryExtensionTest.php b/tests/DependencyInjection/SentryExtensionTest.php index 30a17193..d2055e70 100644 --- a/tests/DependencyInjection/SentryExtensionTest.php +++ b/tests/DependencyInjection/SentryExtensionTest.php @@ -202,6 +202,7 @@ public function testClientIsCreatedFromOptions(): void 'sample_rate' => 1, 'traces_sample_rate' => 1, 'traces_sampler' => new Reference('App\\Sentry\\Tracing\\TracesSampler'), + 'trace_propagation_targets' => ['website.invalid'], 'attach_stacktrace' => true, 'context_lines' => 0, 'enable_compression' => true,