sentry-php icon indicating copy to clipboard operation
sentry-php copied to clipboard

Deprecate `startTransaction`

Open Litarnus opened this issue 1 month ago • 1 comments

There are multiple ways how we could deprecate/remote startTransaction:

Alter the signature to allow returning null values

We would check the current trace_lifecycle value and depending on the value, either return a Transaction or return null. We could also start a (segment) span instead so that all usages of startTransaction would become wrappers over startSpan.

It will break code that operates on the transaction.

Return a "null" Transaction

We could subclass the current Transaction class and override all methods so they don't do anything but don't crash any application. While this looks like the safer approach, it will also hide usages of startTransaction and might make it more difficult to properly switch since everything will just continue to work and it will only be noticed once weird data shows up in sentry

Return an unsampled Transaction

If the current trace_lifecycle is set to stream, startTransaction will return an unsampled transaction. This way nothing breaks but also nothing shows up in Sentry.

All cases should emit debug logs to help figure out what is going on during the transition.

Litarnus avatar Nov 04 '25 13:11 Litarnus

PHP-45

linear[bot] avatar Nov 04 '25 13:11 linear[bot]