Skip to content

Commit e124d27

Browse files
committed
Add missing options
1 parent c0ad7c1 commit e124d27

File tree

7 files changed

+80
-29
lines changed

7 files changed

+80
-29
lines changed

src/DependencyInjection/Configuration.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public function getConfigTreeBuilder(): TreeBuilder
4646
->end()
4747
->booleanNode('register_error_listener')->defaultTrue()->end()
4848
->booleanNode('register_error_handler')->defaultTrue()->end()
49+
->scalarNode('logger')
50+
->info('The service ID of the PSR-3 logger used to log messages coming from the SDK client. Be aware that setting the same logger of the application may create a circular loop when an event fails to be sent.')
51+
->defaultNull()
52+
->end()
4953
->arrayNode('options')
5054
->addDefaultsIfNotSet()
5155
->fixXmlConfig('integration')
@@ -60,7 +64,6 @@ public function getConfigTreeBuilder(): TreeBuilder
6064
->scalarPrototype()->end()
6165
->end()
6266
->booleanNode('default_integrations')->end()
63-
->integerNode('send_attempts')->min(0)->end()
6467
->arrayNode('prefixes')
6568
->defaultValue(array_merge(['%kernel.project_dir%'], array_filter(explode(\PATH_SEPARATOR, get_include_path() ?: ''))))
6669
->scalarPrototype()->end()

src/DependencyInjection/SentryExtension.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ private function registerConfiguration(ContainerBuilder $container, array $confi
106106
$options['before_send_transaction'] = new Reference($options['before_send_transaction']);
107107
}
108108

109+
if (isset($options['before_send_check_in'])) {
110+
$options['before_send_check_in'] = new Reference($options['before_send_check_in']);
111+
}
112+
113+
if (isset($options['before_send_metrics'])) {
114+
$options['before_send_metrics'] = new Reference($options['before_send_metrics']);
115+
}
116+
109117
if (isset($options['before_breadcrumb'])) {
110118
$options['before_breadcrumb'] = new Reference($options['before_breadcrumb']);
111119
}

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,38 @@
3535
</xsd:sequence>
3636

3737
<xsd:attribute name="default-integrations" type="xsd:boolean" />
38-
<xsd:attribute name="send-attempts" type="xsd:integer" />
3938
<xsd:attribute name="sample-rate" type="xsd:float" />
39+
<xsd:attribute name="enable-tracing" type="xsd:boolean" />
4040
<xsd:attribute name="traces-sample-rate" type="xsd:float" />
4141
<xsd:attribute name="profiles-sample-rate" type="xsd:float" />
4242
<xsd:attribute name="traces-sampler" type="xsd:string" />
4343
<xsd:attribute name="attach-stacktrace" type="xsd:boolean" />
44+
<xsd:attribute name="attach-metric-code-locations" type="xsd:boolean" />
4445
<xsd:attribute name="context-lines" type="xsd:integer" />
4546
<xsd:attribute name="enable-compression" type="xsd:boolean" />
4647
<xsd:attribute name="environment" type="xsd:string" />
4748
<xsd:attribute name="logger" type="xsd:string" />
49+
<xsd:attribute name="spotlight" type="xsd:boolean" />
50+
<xsd:attribute name="spotlight-url" type="xsd:string" />
4851
<xsd:attribute name="release" type="xsd:string" />
4952
<xsd:attribute name="server-name" type="xsd:string" />
5053
<xsd:attribute name="before-send" type="xsd:string" />
5154
<xsd:attribute name="before-send-transaction" type="xsd:string" />
55+
<xsd:attribute name="before-send-check-in" type="xsd:string" />
56+
<xsd:attribute name="before-send-metrics" type="xsd:string" />
5257
<xsd:attribute name="error-types" type="xsd:string" />
5358
<xsd:attribute name="max-breadcrumbs" type="xsd:integer" />
5459
<xsd:attribute name="before-breadcrumb" type="xsd:string" />
5560
<xsd:attribute name="send-default-pii" type="xsd:boolean" />
5661
<xsd:attribute name="max-value-length" type="xsd:integer" />
62+
<xsd:attribute name="transport" type="xsd:string" />
63+
<xsd:attribute name="http-client" type="xsd:string" />
5764
<xsd:attribute name="http-proxy" type="xsd:string" />
58-
<xsd:attribute name="http-timeout" type="xsd:integer" />
65+
<xsd:attribute name="http-proxy-authentication" type="xsd:string" />
5966
<xsd:attribute name="http-connect-timeout" type="xsd:integer" />
67+
<xsd:attribute name="http-timeout" type="xsd:integer" />
68+
<xsd:attribute name="http-ssl-verify-peer" type="xsd:boolean" />
69+
<xsd:attribute name="http-compression" type="xsd:boolean" />
6070
<xsd:attribute name="capture-silenced-errors" type="xsd:boolean" />
6171
<xsd:attribute name="max-request-body-size" type="max-request-body-size" />
6272
</xsd:complexType>

tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/** @var ContainerBuilder $container */
99
$container->loadFromExtension('sentry', [
1010
'dsn' => 'https://[email protected]/0',
11+
'logger' => 'app.logger',
1112
'options' => [
1213
'integrations' => ['App\\Sentry\\Integration\\FooIntegration'],
1314
'default_integrations' => false,

tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,37 @@
1111
logger="app.logger"
1212
>
1313
<sentry:options default-integrations="false"
14-
send-attempts="1"
1514
sample-rate="1"
15+
enable-tracing="true"
1616
traces-sample-rate="1"
17-
profiles-sample-rate="1"
1817
traces-sampler="App\Sentry\Tracing\TracesSampler"
18+
profiles-sample-rate="1"
1919
attach-stacktrace="true"
20+
attach-metric-code-locations="true"
2021
context-lines="0"
21-
enable-compression="true"
2222
environment="development"
2323
logger="php"
24+
spotlight="true"
25+
spotlight-url="http://localhost:8969"
2426
release="4.0.x-dev"
2527
server-name="localhost"
2628
before-send="App\Sentry\BeforeSendCallback"
2729
before-send-transaction="App\Sentry\BeforeSendTransactionCallback"
30+
before-send-check-in="App\Sentry\BeforeSendCheckInCallback"
31+
before-send-metrics="App\Sentry\BeforeSendMetricsCallback"
2832
error-types="E_ALL"
2933
max-breadcrumbs="1"
3034
before-breadcrumb="App\Sentry\BeforeBreadcrumbCallback"
3135
send-default-pii="true"
3236
max-value-length="255"
37+
transport="App\Sentry\Transport"
38+
http-client="App\Sentry\HttpClient"
3339
http-proxy="proxy.example.com:8080"
34-
http-timeout="10"
40+
http-proxy-authentication="user:password"
3541
http-connect-timeout="15"
42+
http-timeout="10"
43+
http-ssl-verify-peer="true"
44+
http-compression="true"
3645
capture-silenced-errors="true"
3746
max-request-body-size="none"
3847
>

tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,32 @@ sentry:
55
integrations:
66
- App\Sentry\Integration\FooIntegration
77
default_integrations: false
8-
send_attempts: 1
98
prefixes:
109
- '%kernel.project_dir%'
1110
sample_rate: 1
11+
enable_tracing: true
1212
traces_sample_rate: 1
13-
profiles_sample_rate: 1
1413
traces_sampler: App\Sentry\Tracing\TracesSampler
15-
trace_propagation_targets:
16-
- 'website.invalid'
14+
profiles_sample_rate: 1
1715
attach_stacktrace: true
16+
attach_metric_code_locations: true
1817
context_lines: 0
19-
enable_compression: true
2018
environment: development
2119
logger: php
20+
spotlight: true
21+
spotlight_url: http://localhost:8969
2222
release: 4.0.x-dev
2323
server_name: localhost
24+
ignore_exceptions:
25+
- Symfony\Component\HttpKernel\Exception\BadRequestHttpException
26+
ignore_transactions:
27+
- GET tracing_ignored_transaction
2428
before_send: App\Sentry\BeforeSendCallback
2529
before_send_transaction: App\Sentry\BeforeSendTransactionCallback
30+
before_send_check_in: App\Sentry\BeforeSendCheckInCallback
31+
before_send_metrics: App\Sentry\BeforeSendMetricsCallback
32+
trace_propagation_targets:
33+
- 'website.invalid'
2634
tags:
2735
context: development
2836
error_types: !php/const E_ALL
@@ -34,17 +42,18 @@ sentry:
3442
- '%kernel.project_dir%'
3543
send_default_pii: true
3644
max_value_length: 255
45+
transport: App\Sentry\Transport
46+
http_client: App\Sentry\HttpClient
3747
http_proxy: proxy.example.com:8080
38-
http_timeout: 10
48+
http_proxy_authentication: user:password
3949
http_connect_timeout: 15
50+
http_timeout: 10
51+
http_ssl_verify_peer: true
52+
http_compression: true
4053
capture_silenced_errors: true
4154
max_request_body_size: 'none'
4255
class_serializers:
4356
App\FooClass: App\Sentry\Serializer\FooClassSerializer
44-
ignore_exceptions:
45-
- Symfony\Component\HttpKernel\Exception\BadRequestHttpException
46-
ignore_transactions:
47-
- GET tracing_ignored_transaction
4857
messenger:
4958
enabled: true
5059
capture_soft_fails: false

tests/DependencyInjection/SentryExtensionTest.php

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,47 +198,58 @@ public function testClientIsCreatedFromOptions(): void
198198
$container = $this->createContainerFromFixture('full');
199199
$optionsDefinition = $container->getDefinition('sentry.client.options');
200200
$expectedOptions = [
201+
'dsn' => 'https://[email protected]/0',
201202
'integrations' => new Reference(IntegrationConfigurator::class),
202203
'default_integrations' => false,
203-
'send_attempts' => 1,
204204
'prefixes' => [$container->getParameter('kernel.project_dir')],
205205
'sample_rate' => 1,
206+
'enable_tracing' => true,
206207
'traces_sample_rate' => 1,
207-
'profiles_sample_rate' => 1,
208208
'traces_sampler' => new Reference('App\\Sentry\\Tracing\\TracesSampler'),
209-
'trace_propagation_targets' => ['website.invalid'],
209+
'profiles_sample_rate' => 1,
210210
'attach_stacktrace' => true,
211+
'attach_metric_code_locations' => true,
211212
'context_lines' => 0,
212-
'enable_compression' => true,
213213
'environment' => 'development',
214214
'logger' => 'php',
215+
'spotlight' => true,
216+
'spotlight_url' => 'http://localhost:8969',
215217
'release' => '4.0.x-dev',
216218
'server_name' => 'localhost',
219+
'ignore_exceptions' => [
220+
'Symfony\Component\HttpKernel\Exception\BadRequestHttpException',
221+
],
222+
'ignore_transactions' => [
223+
'GET tracing_ignored_transaction',
224+
],
217225
'before_send' => new Reference('App\\Sentry\\BeforeSendCallback'),
218226
'before_send_transaction' => new Reference('App\\Sentry\\BeforeSendTransactionCallback'),
219-
'tags' => ['context' => 'development'],
227+
'before_send_check_in' => new Reference('App\\Sentry\\BeforeSendCheckInCallback'),
228+
'before_send_metrics' => new Reference('App\\Sentry\\BeforeSendMetricsCallback'),
229+
'trace_propagation_targets' => ['website.invalid'],
230+
'tags' => [
231+
'context' => 'development'
232+
],
220233
'error_types' => \E_ALL,
221234
'max_breadcrumbs' => 1,
222235
'before_breadcrumb' => new Reference('App\\Sentry\\BeforeBreadcrumbCallback'),
223236
'in_app_exclude' => [$container->getParameter('kernel.cache_dir')],
224237
'in_app_include' => [$container->getParameter('kernel.project_dir')],
225238
'send_default_pii' => true,
226239
'max_value_length' => 255,
240+
'transport' => new Reference('App\\Sentry\\Transport'),
241+
'http_client' => new Reference('App\\Sentry\\HttpClient'),
227242
'http_proxy' => 'proxy.example.com:8080',
243+
'http_proxy_authentication' => 'user:password',
228244
'http_timeout' => 10,
229245
'http_connect_timeout' => 15,
246+
'http_ssl_verify_peer' => true,
247+
'http_compression' => true,
230248
'capture_silenced_errors' => true,
231249
'max_request_body_size' => 'none',
232250
'class_serializers' => [
233251
'App\\FooClass' => new Reference('App\\Sentry\\Serializer\\FooClassSerializer'),
234252
],
235-
'dsn' => 'https://[email protected]/0',
236-
'ignore_exceptions' => [
237-
'Symfony\Component\HttpKernel\Exception\BadRequestHttpException',
238-
],
239-
'ignore_transactions' => [
240-
'GET tracing_ignored_transaction',
241-
],
242253
];
243254

244255
$this->assertSame(Options::class, $optionsDefinition->getClass());

0 commit comments

Comments
 (0)