diff --git a/composer.json b/composer.json index 19350f4c..7c21e484 100644 --- a/composer.json +++ b/composer.json @@ -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.22.0", + "sentry/sentry": "^4.23.0", "symfony/cache-contracts": "^1.1||^2.4||^3.0", "symfony/config": "^4.4.20||^5.0.11||^6.0||^7.0||^8.0", "symfony/console": "^4.4.20||^5.0.11||^6.0||^7.0||^8.0", diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index d06cf86c..6b89e468 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -116,6 +116,8 @@ services: Sentry\SentryBundle\Integration\IntegrationConfigurator: arguments: [ [], '' ] + Sentry\Integration\OTLPIntegration: ~ + Sentry\Integration\RequestFetcherInterface: class: Sentry\SentryBundle\Integration\RequestFetcher arguments: diff --git a/tests/DependencyInjection/Fixtures/php/full.php b/tests/DependencyInjection/Fixtures/php/full.php index b7b99cf6..eb55e44d 100644 --- a/tests/DependencyInjection/Fixtures/php/full.php +++ b/tests/DependencyInjection/Fixtures/php/full.php @@ -9,7 +9,10 @@ 'dsn' => 'https://examplePublicKey@o0.ingest.sentry.io/0', 'logger' => 'app.logger', 'options' => [ - 'integrations' => ['App\\Sentry\\Integration\\FooIntegration'], + 'integrations' => [ + 'App\\Sentry\\Integration\\FooIntegration', + 'Sentry\\Integration\\OTLPIntegration', + ], 'default_integrations' => false, 'prefixes' => ['%kernel.project_dir%'], 'sample_rate' => 1, diff --git a/tests/DependencyInjection/Fixtures/xml/full.xml b/tests/DependencyInjection/Fixtures/xml/full.xml index e02fc333..503f5ad1 100644 --- a/tests/DependencyInjection/Fixtures/xml/full.xml +++ b/tests/DependencyInjection/Fixtures/xml/full.xml @@ -50,6 +50,7 @@ strict-trace-continuation="true" > App\Sentry\Integration\FooIntegration + Sentry\Integration\OTLPIntegration website.invalid %kernel.project_dir% development diff --git a/tests/DependencyInjection/Fixtures/yml/full.yml b/tests/DependencyInjection/Fixtures/yml/full.yml index ea1eebf0..3e6b372a 100644 --- a/tests/DependencyInjection/Fixtures/yml/full.yml +++ b/tests/DependencyInjection/Fixtures/yml/full.yml @@ -4,6 +4,7 @@ sentry: options: integrations: - App\Sentry\Integration\FooIntegration + - Sentry\Integration\OTLPIntegration default_integrations: false prefixes: - '%kernel.project_dir%' diff --git a/tests/DependencyInjection/SentryExtensionTest.php b/tests/DependencyInjection/SentryExtensionTest.php index bd12b607..11db7ae6 100644 --- a/tests/DependencyInjection/SentryExtensionTest.php +++ b/tests/DependencyInjection/SentryExtensionTest.php @@ -272,6 +272,7 @@ public function testClientIsCreatedFromOptions(): void $integrationConfiguratorDefinition = $container->getDefinition(IntegrationConfigurator::class); $expectedIntegrations = [ new Reference('App\\Sentry\\Integration\\FooIntegration'), + new Reference('Sentry\\Integration\\OTLPIntegration'), ]; $this->assertSame(IntegrationConfigurator::class, $integrationConfiguratorDefinition->getClass()); diff --git a/tests/End2End/End2EndTest.php b/tests/End2End/End2EndTest.php index 1b9ba382..e9e94daa 100644 --- a/tests/End2End/End2EndTest.php +++ b/tests/End2End/End2EndTest.php @@ -220,7 +220,7 @@ public function testMessengerCaptureHardFailure(): void { $this->skipIfMessengerIsMissing(); - $client = static::createClient(); + $client = static::createClient(['debug' => false]); $client->request('GET', '/dispatch-unrecoverable-message'); @@ -238,7 +238,7 @@ public function testMessengerCaptureSoftFailCanBeDisabled(): void { $this->skipIfMessengerIsMissing(); - $client = static::createClient(); + $client = static::createClient(['debug' => false]); $client->request('GET', '/dispatch-message'); @@ -256,7 +256,7 @@ public function testIsolateBreadcrumbsByMessage(): void { $this->skipIfMessengerIsMissing(); - $client = static::createClient(); + $client = static::createClient(['debug' => false]); // Create two messages $client->request('GET', '/dispatch-unrecoverable-message'); diff --git a/tests/End2End/Fixtures/config_otlp_default.yaml b/tests/End2End/Fixtures/config_otlp_default.yaml new file mode 100644 index 00000000..d70313a9 --- /dev/null +++ b/tests/End2End/Fixtures/config_otlp_default.yaml @@ -0,0 +1,4 @@ +sentry: + options: + integrations: + - Sentry\Integration\OTLPIntegration diff --git a/tests/End2End/OtlpTracesEndpointEnd2EndTest.php b/tests/End2End/OtlpTracesEndpointEnd2EndTest.php new file mode 100644 index 00000000..ee2704e8 --- /dev/null +++ b/tests/End2End/OtlpTracesEndpointEnd2EndTest.php @@ -0,0 +1,37 @@ +boot(); + + /** @var HubInterface $hub */ + $hub = $kernel->getContainer()->get('test.hub'); + $this->assertNotNull($hub->getClient()); + $this->assertNotNull($hub->getIntegration(\Sentry\Integration\OTLPIntegration::class)); + + $this->assertSame( + 'http://example.com/sentry/api/1/integration/otlp/v1/traces/', + getOtlpTracesEndpointUrl() + ); + + $kernel->shutdown(); + } +}