Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"php": "^7.2||^8.0",
"guzzlehttp/psr7": "^2.1.1",
"jean85/pretty-package-versions": "^1.5||^2.0",
"sentry/sentry": "^4.14.1",
"sentry/sentry": "^4.15.0",
"symfony/cache-contracts": "^1.1||^2.4||^3.0",
"symfony/config": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/console": "^4.4.20||^5.0.11||^6.0||^7.0",
Expand Down
7 changes: 6 additions & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ parameters:
count: 1
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Cannot access offset 'before_send_logs' on mixed\\.$#"
count: 1
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Parameter \\#1 \\$array of function array_filter expects array, mixed given\\.$#"
count: 1
Expand All @@ -97,7 +102,7 @@ parameters:

-
message: "#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, mixed given\\.$#"
count: 10
count: 11
path: src/DependencyInjection/SentryExtension.php

-
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->max(1.0)
->info('The sampling factor to apply to profiles. A value of 0 will deny sending any profiles, and a value of 1 will send all profiles. Profiles are sampled in relation to traces_sample_rate')
->end()
->booleanNode('enable_logs')->end()
->booleanNode('attach_stacktrace')->end()
->booleanNode('attach_metric_code_locations')->end()
->integerNode('context_lines')->min(0)->end()
Expand Down Expand Up @@ -112,6 +113,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('before_send_transaction')->end()
->scalarNode('before_send_check_in')->end()
->scalarNode('before_send_metrics')->end()
->scalarNode('before_send_logs')->end()
->variableNode('trace_propagation_targets')->end()
->arrayNode('tags')
->useAttributeAsKey('name')
Expand Down
4 changes: 4 additions & 0 deletions src/DependencyInjection/SentryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ private function registerConfiguration(ContainerBuilder $container, array $confi
$options['before_send_metrics'] = new Reference($options['before_send_metrics']);
}

if (isset($options['before_send_logs'])) {
$options['before_send_logs'] = new Reference($options['before_send_logs']);
}

if (isset($options['before_breadcrumb'])) {
$options['before_breadcrumb'] = new Reference($options['before_breadcrumb']);
}
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 @@ -37,6 +37,7 @@
<xsd:attribute name="default-integrations" type="xsd:boolean" />
<xsd:attribute name="sample-rate" type="xsd:float" />
<xsd:attribute name="enable-tracing" type="xsd:boolean" />
<xsd:attribute name="enable-logs" type="xsd:boolean" />
<xsd:attribute name="traces-sample-rate" type="xsd:float" />
<xsd:attribute name="profiles-sample-rate" type="xsd:float" />
<xsd:attribute name="traces-sampler" type="xsd:string" />
Expand All @@ -54,6 +55,7 @@
<xsd:attribute name="before-send-transaction" type="xsd:string" />
<xsd:attribute name="before-send-check-in" type="xsd:string" />
<xsd:attribute name="before-send-metrics" type="xsd:string" />
<xsd:attribute name="before-send-logs" type="xsd:string" />
<xsd:attribute name="error-types" type="xsd:string" />
<xsd:attribute name="max-breadcrumbs" type="xsd:integer" />
<xsd:attribute name="before-breadcrumb" type="xsd:string" />
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 @@ -17,6 +17,7 @@
'traces_sample_rate' => 1,
'traces_sampler' => 'App\\Sentry\\Tracing\\TracesSampler',
'profiles_sample_rate' => 1,
'enable_logs' => true,
'attach_stacktrace' => true,
'attach_metric_code_locations' => true,
'context_lines' => 0,
Expand All @@ -32,6 +33,7 @@
'before_send_transaction' => 'App\\Sentry\\BeforeSendTransactionCallback',
'before_send_check_in' => 'App\\Sentry\\BeforeSendCheckInCallback',
'before_send_metrics' => 'App\\Sentry\\BeforeSendMetricsCallback',
'before_send_logs' => 'App\\Sentry\\BeforeSendLogsCallback',
'trace_propagation_targets' => ['website.invalid'],
'tags' => [
'context' => 'development',
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 @@ -13,6 +13,7 @@
<sentry:options default-integrations="false"
sample-rate="1"
enable-tracing="true"
enable-logs="true"
traces-sample-rate="1"
traces-sampler="App\Sentry\Tracing\TracesSampler"
profiles-sample-rate="1"
Expand All @@ -29,6 +30,7 @@
before-send-transaction="App\Sentry\BeforeSendTransactionCallback"
before-send-check-in="App\Sentry\BeforeSendCheckInCallback"
before-send-metrics="App\Sentry\BeforeSendMetricsCallback"
before-send-logs="App\Sentry\BeforeSendLogsCallback"
error-types="E_ALL"
max-breadcrumbs="1"
before-breadcrumb="App\Sentry\BeforeBreadcrumbCallback"
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 @@ -12,6 +12,7 @@ sentry:
traces_sample_rate: 1
traces_sampler: App\Sentry\Tracing\TracesSampler
profiles_sample_rate: 1
enable_logs: true
attach_stacktrace: true
attach_metric_code_locations: true
context_lines: 0
Expand All @@ -29,6 +30,7 @@ sentry:
before_send_transaction: App\Sentry\BeforeSendTransactionCallback
before_send_check_in: App\Sentry\BeforeSendCheckInCallback
before_send_metrics: App\Sentry\BeforeSendMetricsCallback
before_send_logs: App\Sentry\BeforeSendLogsCallback
trace_propagation_targets:
- 'website.invalid'
tags:
Expand Down
2 changes: 2 additions & 0 deletions tests/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public function testClientIsCreatedFromOptions(): void
'traces_sample_rate' => 1,
'traces_sampler' => new Reference('App\\Sentry\\Tracing\\TracesSampler'),
'profiles_sample_rate' => 1,
'enable_logs' => true,
'attach_stacktrace' => true,
'attach_metric_code_locations' => true,
'context_lines' => 0,
Expand All @@ -228,6 +229,7 @@ public function testClientIsCreatedFromOptions(): void
'before_send_transaction' => new Reference('App\\Sentry\\BeforeSendTransactionCallback'),
'before_send_check_in' => new Reference('App\\Sentry\\BeforeSendCheckInCallback'),
'before_send_metrics' => new Reference('App\\Sentry\\BeforeSendMetricsCallback'),
'before_send_logs' => new Reference('App\\Sentry\\BeforeSendLogsCallback'),
'trace_propagation_targets' => ['website.invalid'],
'tags' => [
'context' => 'development',
Expand Down
Loading