Skip to content

Add package info to SDK payload #1823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

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
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
2 participants