Skip to content

Support http_connect_timeout and http_timeout options #593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Add `TracingDriverConnectionInterface::getNativeConnection()` method to get the original driver connection (#597)
- Add `options.http_timeout` and `options.http_connect_timeout` configuration options (#593)

## 4.2.10 (2022-05-17)

Expand Down
8 changes: 8 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ public function getConfigTreeBuilder(): TreeBuilder
->booleanNode('send_default_pii')->end()
->integerNode('max_value_length')->min(0)->end()
->scalarNode('http_proxy')->end()
->integerNode('http_connect_timeout')
->min(0)
->info('The maximum number of seconds to wait while trying to connect to a server. It works only when using the default transport.')
->end()
->integerNode('http_timeout')
->min(0)
->info('The maximum execution time for the request+response as a whole. It works only when using the default transport.')
->end()
->booleanNode('capture_silenced_errors')->end()
->enumNode('max_request_body_size')
->values([
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/schema/sentry-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<xsd:attribute name="send-default-pii" type="xsd:boolean" />
<xsd:attribute name="max-value-length" type="xsd:integer" />
<xsd:attribute name="http-proxy" type="xsd:string" />
<xsd:attribute name="http-timeout" type="xsd:integer" />
<xsd:attribute name="http-connect-timeout" type="xsd:integer" />
<xsd:attribute name="capture-silenced-errors" type="xsd:boolean" />
<xsd:attribute name="max-request-body-size" type="max-request-body-size" />
</xsd:complexType>
Expand Down
2 changes: 2 additions & 0 deletions tests/DependencyInjection/Fixtures/php/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
'send_default_pii' => true,
'max_value_length' => 255,
'http_proxy' => 'proxy.example.com:8080',
'http_timeout' => 10,
'http_connect_timeout' => 15,
'capture_silenced_errors' => true,
'max_request_body_size' => 'none',
'class_serializers' => ['App\\FooClass' => 'App\\Sentry\\Serializer\\FooClassSerializer'],
Expand Down
2 changes: 2 additions & 0 deletions tests/DependencyInjection/Fixtures/xml/full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
send-default-pii="true"
max-value-length="255"
http-proxy="proxy.example.com:8080"
http-timeout="10"
http-connect-timeout="15"
capture-silenced-errors="true"
max-request-body-size="none"
>
Expand Down
2 changes: 2 additions & 0 deletions tests/DependencyInjection/Fixtures/yml/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ sentry:
send_default_pii: true
max_value_length: 255
http_proxy: proxy.example.com:8080
http_timeout: 10
http_connect_timeout: 15
capture_silenced_errors: true
max_request_body_size: 'none'
class_serializers:
Expand Down
2 changes: 2 additions & 0 deletions tests/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ public function testClientIsCreatedFromOptions(): void
'send_default_pii' => true,
'max_value_length' => 255,
'http_proxy' => 'proxy.example.com:8080',
'http_timeout' => 10,
'http_connect_timeout' => 15,
'capture_silenced_errors' => true,
'max_request_body_size' => 'none',
'class_serializers' => [
Expand Down