-
-
Notifications
You must be signed in to change notification settings - Fork 462
Closed
Description
Environment
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
[email protected]
Steps to Reproduce
- initialize sentry with a very low sample rate for easier repro
- call
$transaction = startTransaction - call
SentrySdk::getCurrentHub()->setSpan($transaction) - call
SentrySdk::getCurrentHub()->getTransaction()
Expected Result
I expected to get the instance of the Transaction I just started.
Actual Result
getTransaction returned null because when you call startTransaction and this transaction isn't getting sampled it does not initialize the SpanRecorder (Hub.php:256). However, getTransaction gets the transaction from Scope which checks for an active SpanRecorder and returns null otherwise.
This behavior is not documented anywhere, I think it would suffice to add a note to the Hub::getTransaction method that if it's not sampled it will return null.