Skip to content

Commit 072c454

Browse files
committed
feat(integrations): Add support for HTTP Client baggage propagation (#663)
1 parent 70dcc0b commit 072c454

File tree

8 files changed

+13
-0
lines changed

8 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Add support for tracing of the Symfony HTTP client requests (#606)
66
- Support logging the impersonator user, if any (#647)
77
- ref: Use constant for the SDK version (#662)
8+
- Add support for HTTP Client baggage propagation (#663)
89

910
## 4.3.1 (2022-10-10)
1011

src/DependencyInjection/Configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function getConfigTreeBuilder(): TreeBuilder
4848
->arrayNode('options')
4949
->addDefaultsIfNotSet()
5050
->fixXmlConfig('integration')
51+
->fixXmlConfig('trace_propagation_target')
5152
->fixXmlConfig('tag')
5253
->fixXmlConfig('class_serializer')
5354
->fixXmlConfig('prefix', 'prefixes')
@@ -72,6 +73,10 @@ public function getConfigTreeBuilder(): TreeBuilder
7273
->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.')
7374
->end()
7475
->scalarNode('traces_sampler')->end()
76+
->arrayNode('trace_propagation_targets')
77+
->scalarPrototype()->end()
78+
->beforeNormalization()->castToArray()->end()
79+
->end()
7580
->booleanNode('attach_stacktrace')->end()
7681
->integerNode('context_lines')->min(0)->end()
7782
->booleanNode('enable_compression')->end()

src/Resources/config/schema/sentry-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<xsd:complexType name="options">
2424
<xsd:sequence>
2525
<xsd:element name="integration" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
26+
<xsd:element name="trace-propagation-target" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
2627
<xsd:element name="prefix" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
2728
<xsd:element name="tag" type="tag" minOccurs="0" maxOccurs="unbounded" />
2829
<xsd:element name="in-app-exclude" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />

tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function testProcessConfigurationWithDefaultConfiguration(): void
2626
'options' => [
2727
'integrations' => [],
2828
'prefixes' => array_merge(['%kernel.project_dir%'], array_filter(explode(\PATH_SEPARATOR, get_include_path() ?: ''))),
29+
'trace_propagation_targets' => [],
2930
'environment' => '%kernel.environment%',
3031
'release' => PrettyVersions::getRootPackageVersion()->getPrettyVersion(),
3132
'tags' => [],

tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'sample_rate' => 1,
1818
'traces_sample_rate' => 1,
1919
'traces_sampler' => 'App\\Sentry\\Tracing\\TracesSampler',
20+
'trace_propagation_targets' => ['website.invalid'],
2021
'attach_stacktrace' => true,
2122
'context_lines' => 0,
2223
'enable_compression' => true,

tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
max-request-body-size="none"
3737
>
3838
<sentry:integration>App\Sentry\Integration\FooIntegration</sentry:integration>
39+
<sentry:trace-propagation-target>website.invalid</sentry:trace-propagation-target>
3940
<sentry:prefix>%kernel.project_dir%</sentry:prefix>
4041
<sentry:tag name="context">development</sentry:tag>
4142
<sentry:in-app-exclude>%kernel.cache_dir%</sentry:in-app-exclude>

tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ sentry:
1212
sample_rate: 1
1313
traces_sample_rate: 1
1414
traces_sampler: App\Sentry\Tracing\TracesSampler
15+
trace_propagation_targets:
16+
- 'website.invalid'
1517
attach_stacktrace: true
1618
context_lines: 0
1719
enable_compression: true

tests/DependencyInjection/SentryExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ public function testClientIsCreatedFromOptions(): void
202202
'sample_rate' => 1,
203203
'traces_sample_rate' => 1,
204204
'traces_sampler' => new Reference('App\\Sentry\\Tracing\\TracesSampler'),
205+
'trace_propagation_targets' => ['website.invalid'],
205206
'attach_stacktrace' => true,
206207
'context_lines' => 0,
207208
'enable_compression' => true,

0 commit comments

Comments
 (0)