Skip to content
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

Add Scope::setTransactionName() #1719

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add Scope::setTransactionName() #1719

wants to merge 1 commit into from

Conversation

cleptric
Copy link
Member

Another approach to fix #1716.

Compared to other SDKs, like Python, the PHP SDK never exposed the transaction name on the scope.

With these changes, the transaction name will be synced with the scope when set on the transaction and vice versa. If an error happens while the transaction is still unfinished, we now set a proper transaction name on the error instead of relying on the user manually passing the name as part of the EventHint or relying on the TransactionIntegration setting $_SERVER['PATH_INFO'], which is a bad default.

// Before
$hint = EventHint::fromArray([
    'extra' => [
        'transaction' => 'GET /example',
    ],
]);
captureException($e, $hint);

// After
configureScope(function (Scope $scope) {
    $scope->setTransactionName('GET /example');
});
captureException($e);

// After, in case of an active transaction
captureException($e);

Reliably setting the transaction name on all errors allows for some neat features, such as using Discover to create a query to group your transactions by error count.

image

@cleptric cleptric changed the title Add Scope:: setTransactionName() Add Scope::setTransactionName() Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant