-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Custom Instrumentation is Not working with New APIs in V8 #13470
Comments
So I think what I would do in this case is:
function endCurrentActiveSpan() {
const activeSpan = Sentry.getActiveSpan();
const rootSpan = activeSpan && Sentry.getRootSpan(activeSpan);
if (rootSpan) {
rootSpan.end();
}
} By default all new spans (e.g. http spans etc) will be attached to the currently active root span. If you want to delimit actions manually like this, I would first end the active root span to ensure we have a clean slate.
As of now, you'll need to install import { startIdleSpan } from '@sentry/core';
// everything (e.g. http spans etc) will now be attached to this
// this will auto-end after some seconds of inactivity, or you can also manually end it at any time
// if a navigation happens this will be auto-ended as well
const rootSpan = startIdleSpan({
name: 'span name',
}); Then you do not need to manually attach any spans to this, anything will just go to it by default. |
Ah, I see, that's right of course. You can extend the timeouts: startIdleSpan({ name: 'my span' }, { idleTimeout: 60000, finalTimeout: 60000, childSpanTimeout: 60000 }); Or whatever timeouts make sense to you - the defaults are 1s / 30s / 15s. The meaning of these timeouts is:
The reason we have these timeouts is that stuff in the browser can be hard to be certain about, e.g. http requests may hang or similar things, leading to never ending spans. But if you know what you're doing, you can safely extend these timeouts and manually end the span instead. |
Closing this for clean-up. Please re-open if it still applies. Thank you! |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
8.116.0
Framework Version
React SadK 8.116.0
Link to Sentry event
https://hrc-t3.sentry.io/performance/?project=4507842173861888&query=&referrer=performance-transaction-summary&showTransactions=recent&source=performance_transaction_summary&statsPeriod=14d&unselectedSeries=p100%28%29&unselectedSeries=avg%28%29
Reproduction Example/SDK Setup
Sentry Instrument.js file - we have added the sentry Intialization
Steps to Reproduce
Custom Instrumentation: We are looking for custom instrumentation to determine the htp request, UI thread and others request in a single group of spans/transaction
In Version7.XX> this feature was available using startTransaction and end the transaction anywhere after custom logic of code
In Newer version. - With startSpan, startSpanManual, or startInActiveSpan() - all these are starting the span correctly, and ending in callback - working fine,
Requirment:
We dont want to close the span immediately after callback end. To be precise, we want to have any callback as well.
Example: start the user journey span at one component
lets says Component 1 - startSpan()
But performing few actives - like filling a form of 4-5 components
Want to close this span and need to have the entire user journey - HTTP request, UI, component timing, loading images resources script ,etc loading
Closing can be at component 5 .
This we are not able to achieve as callback cannot be single-line. startIdelSpan() - this is also not working.
StartInActiveSpa ()- this works fine but do not capture any http request, resources script etc.
Componet1:
Component 5:
Reference link: #12222
Expected Result
In my Transaction - it should able to track all the HTTP request , reasoucrs, script, etc
Actual Result
In my Transaction - it should able to track all the HTTP request , reasoucrs, script, etc
The text was updated successfully, but these errors were encountered: