-
-
Couldn't load subscription status.
- Fork 1.7k
Description
Long ago, Sentry events had the idea of a culprit, which was a string approximately meaning, "the context in which this error happened." A number of years ago, a(n only-partially-successful) attempt was made to replace culprit with transaction, which remained a string with the same basic meaning. Then we got into the APM business, and began to use the word transaction to refer to the root span of a tracing span tree, while still retaining it in some places as a string meaning "the name of the active (tracing-type) transaction," or keeping its original meaning if tracing isn't enabled. This caused confusion, so we changed some APIs to refer to the string as transactionName, so that transaction could mean "root span object." We've also made various changes throughout the years (both recently and in the more distant past) to improve our ability to figure out the right transaction value.
So where are we now? Kind of in a mess, unfortunately.
-
Scope.setTransactionNameandScope.getTransaction.setNamechange two different, independent pieces of data. -
In the
requestDatamodule in@sentry/utilswe haveextractTransactionandextractPathForTransaction, which do slightly different things and which are called by bothaddRequestDataToEvent(called for both errors and transactions) andaddRequestDataToTransaction(called only for transactions, but not in every SDK).extractPathForTransactionis also called directly by other parts of the SDK, at various points of the transaction lifecycle. This makes it almost prohibitively hard to make changes, because reasoning about the effects of those changes across all of the various code paths is so difficult. -
An event's
transactionvalue can come from at least six different places: event creation, from the scope, from theaddRequestDataToEventfunction called by event processors in various SDKs, from theaddRequestDataToTransactionfunction called by ourExpresstracing handler, from an error event's stackframes, and soon from the newRequestDataintegration. Which (and how many) of these various options apply depends on the type of the event, which SDK is running, the settings passed to ourExpressrequest handler, and possibly other things I'm forgetting. This means, among other things, that an error event and its associated transaction event might have differenttransactionvalues. (See screenshot below.) -
Events also have a
transactiontag, which comes exclusively from the name of the activeTransactionobject, but which gets overwritten by thetransactionvalue during ingest, regardless of whether it's set or what it's set to. -
We still have a
Transactionintegration dating from the pre-APM-attempt-to-replace-culprit-with-transaction days, which uses stackframes to find an event'stransaction(with the result that people end up with minified function names as their transaction values).
Before v8, let's take a hard look at this.
Example of second point above:
