From 1e5d4612805f3044988566a84080e19e8ff486c6 Mon Sep 17 00:00:00 2001 From: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:15:17 +0800 Subject: [PATCH 1/2] feat(sentry): add backwards compatibility for legacy configuration keys Add compatibility layer to support old Sentry configuration structure while maintaining new API. This ensures smooth migration path for users upgrading from previous versions. Changes: - Map `sentry.tracing.spans` to `sentry.tracing_spans` - Map `sentry.tracing.extra_tags` to `sentry.tracing_tags` - Migrate `sentry.tracing.enable.*` to flat `sentry.tracing.*` structure - Add `compatibilityConfigurations()` method to handle legacy config migration This maintains backwards compatibility while supporting the simplified configuration structure introduced in recent refactoring. --- .../src/Listener/SetupSentryListener.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sentry/src/Listener/SetupSentryListener.php b/src/sentry/src/Listener/SetupSentryListener.php index 9fd11f9d4..78a71712d 100644 --- a/src/sentry/src/Listener/SetupSentryListener.php +++ b/src/sentry/src/Listener/SetupSentryListener.php @@ -78,12 +78,30 @@ public function listen(): array public function process(object $event): void { + $this->compatibilityConfigurations(); $this->setupRequestLifecycle(); $this->setupRedisEventEnable(); $this->setupIgnoreExceptions(); $this->registerLoggerChannel(); } + protected function compatibilityConfigurations(): void + { + if ($this->config->has('sentry.tracing.spans') && ! $this->config->has('sentry.tracing_spans')) { + $this->config->set('sentry.tracing_spans', $this->config->get('sentry.tracing.spans')); + } + + if ($this->config->has('sentry.tracing.extra_tags') && ! $this->config->has('sentry.tracing_tags')) { + $this->config->set('sentry.tracing_tags', $this->config->get('sentry.tracing.extra_tags')); + } + + if ($this->config->has('sentry.tracing.enable')) { + foreach ($this->config->get('sentry.tracing.enable') as $key => $enabled) { + $this->config->set("sentry.tracing.{$key}", $enabled); + } + } + } + protected function setupIgnoreExceptions(): void { $configKey = 'sentry.ignore_exceptions'; From f99934c4aed3ede79ead3cf6209b7a735292dfb0 Mon Sep 17 00:00:00 2001 From: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:20:39 +0800 Subject: [PATCH 2/2] refactor(sentry): streamline compatibility configuration mapping for tracing keys --- .../src/Listener/SetupSentryListener.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/sentry/src/Listener/SetupSentryListener.php b/src/sentry/src/Listener/SetupSentryListener.php index 78a71712d..a9ee14ffc 100644 --- a/src/sentry/src/Listener/SetupSentryListener.php +++ b/src/sentry/src/Listener/SetupSentryListener.php @@ -87,17 +87,16 @@ public function process(object $event): void protected function compatibilityConfigurations(): void { - if ($this->config->has('sentry.tracing.spans') && ! $this->config->has('sentry.tracing_spans')) { - $this->config->set('sentry.tracing_spans', $this->config->get('sentry.tracing.spans')); - } - - if ($this->config->has('sentry.tracing.extra_tags') && ! $this->config->has('sentry.tracing_tags')) { - $this->config->set('sentry.tracing_tags', $this->config->get('sentry.tracing.extra_tags')); - } + $mapping = [ + 'sentry.tracing.spans' => 'sentry.tracing_spans', + 'sentry.tracing.extra_tags' => 'sentry.tracing_tags', + 'sentry.tracing.enable' => 'sentry.tracing', // MUST be last + ]; - if ($this->config->has('sentry.tracing.enable')) { - foreach ($this->config->get('sentry.tracing.enable') as $key => $enabled) { - $this->config->set("sentry.tracing.{$key}", $enabled); + foreach ($mapping as $oldKey => $newKey) { + if ($this->config->has($oldKey) && ! $this->config->has($newKey)) { + $this->config->set($newKey, $this->config->get($oldKey)); + $this->config->set($oldKey, []); } } }