-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(trace-view): Add UI fallback to old view for STs #73684
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type {Location, LocationDescriptorObject} from 'history'; | ||
|
||
import {PAGE_URL_PARAM} from 'sentry/constants/pageFilters'; | ||
import type {Organization, OrganizationSummary} from 'sentry/types'; | ||
import type {Organization} from 'sentry/types'; | ||
import {getTimeStampFromTableDateField} from 'sentry/utils/dates'; | ||
import type { | ||
EventLite, | ||
|
@@ -29,7 +29,7 @@ export function getTraceDetailsUrl({ | |
}: { | ||
dateSelection; | ||
location: Location; | ||
organization: Pick<OrganizationSummary, 'slug' | 'features'>; | ||
organization: Organization; | ||
traceSlug: string; | ||
demo?: string; | ||
eventId?: string; | ||
|
@@ -46,6 +46,17 @@ export function getTraceDetailsUrl({ | |
[PAGE_URL_PARAM.PAGE_END]: end, | ||
}; | ||
|
||
const oldTraceUrl = { | ||
pathname: normalizeUrl( | ||
`/organizations/${organization.slug}/performance/trace/${traceSlug}/` | ||
), | ||
query: queryParams, | ||
}; | ||
|
||
if (shouldForceRouteToOldView(organization, timestamp)) { | ||
return oldTraceUrl; | ||
} | ||
|
||
if (organization.features.includes('trace-view-v1')) { | ||
if (spanId) { | ||
queryParams.node = [`span-${spanId}`, `txn-${eventId}`]; | ||
|
@@ -68,12 +79,28 @@ export function getTraceDetailsUrl({ | |
queryParams.limit = DEFAULT_TRACE_ROWS_LIMIT; | ||
} | ||
|
||
return { | ||
pathname: normalizeUrl( | ||
`/organizations/${organization.slug}/performance/trace/${traceSlug}/` | ||
), | ||
query: queryParams, | ||
}; | ||
return oldTraceUrl; | ||
} | ||
|
||
/** | ||
* Single tenant, on-premise etc. users may not have span extraction enabled. | ||
* | ||
* This code can be removed at the time we're sure all STs have rolled out span extraction. | ||
*/ | ||
export function shouldForceRouteToOldView( | ||
organization: Organization, | ||
timestamp: string | number | undefined | ||
) { | ||
const usableTimestamp = getTimeStampFromTableDateField(timestamp); | ||
if (!usableTimestamp) { | ||
// Timestamps must always be provided for the new view, if it doesn't exist, fall back to the old view. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @k-fish , it just helps make the query faster. The traceview still loads without it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize it works on the api but the frontend it should be mandatory no? it significantly improves trace performance, I had assumed all callsites were sending it where appropriate for the new view. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we do it from all callsites. However, even without it the new traceview should load faster than the old traceview I believe. But yeah, just wanted to point it out in case you thought that the new view wouldn't work at all without timestamp. |
||
return true; | ||
} | ||
|
||
return ( | ||
organization.extraOptions?.traces.checkSpanExtractionDate && | ||
organization.extraOptions?.traces.spansExtractionDate <= usableTimestamp | ||
); | ||
} | ||
|
||
function transactionVisitor() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new line break here makes the comment's location misleading IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated should actually be annotated, which makes it show up in editors and also moves with the key properly, going to change it to that instead.