Skip to content

Conversation

@stayallive
Copy link
Collaborator

@stayallive stayallive commented Apr 15, 2025

I have opted to implement this using a registration. This gives us the option to replace this integration in framework SDKs so we can also inject the framework SDK version by providing a specific SDKModuleIntegration there. This integration serves as a fallback is therefore registered at the end and only does something in case there is are no modules set by for example the default modules integration.

I misunderstood the assignment completely. So it's now rewritten to set information on the packages key of the SDK payload. Framework SDK are expected to add a integration like:

class LaravelPackageIntegration implements IntegrationInterface
{
    public function setupOnce(): void
    {
        Scope::addGlobalEventProcessor(static function (Event $event, ?EventHint $hint = null): Event {
            $self = SentrySdk::getCurrentHub()->getIntegration(self::class);

            if (!$self instanceof self) {
                return $event;
            }

            $event->appendSdkPackage([
                'name' => 'composer:sentry/sentry-laravel',
                'version' => Version::SDK_VERSION,
            ]);

            return $event;
        });
    }
}

This will append a package to the payload.

Fixes #1822

@stayallive stayallive requested a review from cleptric April 15, 2025 10:07
@stayallive stayallive self-assigned this Apr 15, 2025
@stayallive stayallive changed the title Always add the SDK as module when modules integration is disabled Add package info to SDK payload Apr 24, 2025
@stayallive stayallive requested a review from cleptric April 24, 2025 08:12
@cleptric cleptric merged commit 914a207 into master May 12, 2025
41 checks passed
@cleptric cleptric deleted the default-packages-context branch May 12, 2025 06:25
@stayallive stayallive restored the default-packages-context branch May 15, 2025 13:26
@stayallive stayallive deleted the default-packages-context branch May 15, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add packages context

3 participants