Skip to content

Is it possible to have all javascript XHR requests instrumented automatically? #6737

Answered by lforst
fpw23 asked this question in Q&A
Discussion options

You must be logged in to vote

For requests to be traced there needs to be an active transaction. Out of the box, transactions are only created on page load and on page navigations. These transactions finish automatically after some time.

If you want requests to be traced. You need to manually start a transaction with const t = Sentry.startTransaction() and put it on the scope via Sentry.getCurrentHub().getScope()?.setSpan(t). After you're done with the request you can call t.finish() to send the transaction to Sentry.

There is currently no way of automatically creating transactions for all requests.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@smeubank
Comment options

Answer selected by fpw23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants