-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(suspect-spans): Add empty spans tab (#28315)
This adds a new empty tab for the suspect spans feature behind the `performance-suspect-spans-view` flag.
- Loading branch information
Showing
8 changed files
with
184 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ enum Tab { | |
WebVitals, | ||
Tags, | ||
Events, | ||
Spans, | ||
} | ||
|
||
export default Tab; |
16 changes: 16 additions & 0 deletions
16
static/app/views/performance/transactionSummary/transactionSpans/content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Location} from 'history'; | ||
|
||
import {Organization} from 'app/types'; | ||
import EventView from 'app/utils/discover/eventView'; | ||
|
||
type Props = { | ||
location: Location; | ||
organization: Organization; | ||
eventView: EventView; | ||
}; | ||
|
||
function SpansContent(_props: Props) { | ||
return <p>spans</p>; | ||
} | ||
|
||
export default SpansContent; |
70 changes: 70 additions & 0 deletions
70
static/app/views/performance/transactionSummary/transactionSpans/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import {Location} from 'history'; | ||
|
||
import {t} from 'app/locale'; | ||
import {Organization, Project} from 'app/types'; | ||
import EventView from 'app/utils/discover/eventView'; | ||
import {decodeScalar} from 'app/utils/queryString'; | ||
import {MutableSearch} from 'app/utils/tokenizeSearch'; | ||
import withOrganization from 'app/utils/withOrganization'; | ||
import withProjects from 'app/utils/withProjects'; | ||
|
||
import PageLayout from '../pageLayout'; | ||
import Tab from '../tabs'; | ||
|
||
import SpansContent from './content'; | ||
|
||
type Props = { | ||
location: Location; | ||
organization: Organization; | ||
projects: Project[]; | ||
}; | ||
|
||
function TransactionSpans(props: Props) { | ||
const {location, organization, projects} = props; | ||
|
||
return ( | ||
<PageLayout | ||
location={location} | ||
organization={organization} | ||
projects={projects} | ||
tab={Tab.Spans} | ||
getDocumentTitle={getDocumentTitle} | ||
generateEventView={generateEventView} | ||
childComponent={SpansContent} | ||
/> | ||
); | ||
} | ||
|
||
function generateEventView(location: Location, transactionName: string): EventView { | ||
const query = decodeScalar(location.query.query, ''); | ||
const conditions = new MutableSearch(query); | ||
// TODO: what should this event type be? | ||
conditions | ||
.setFilterValues('event.type', ['transaction']) | ||
.setFilterValues('transaction', [transactionName]); | ||
|
||
return EventView.fromNewQueryWithLocation( | ||
{ | ||
id: undefined, | ||
version: 2, | ||
name: transactionName, | ||
fields: ['count()'], | ||
query: conditions.formatString(), | ||
projects: [], | ||
}, | ||
location | ||
); | ||
} | ||
|
||
function getDocumentTitle(transactionName: string): string { | ||
const hasTransactionName = | ||
typeof transactionName === 'string' && String(transactionName).trim().length > 0; | ||
|
||
if (hasTransactionName) { | ||
return [String(transactionName).trim(), t('Performance')].join(' - '); | ||
} | ||
|
||
return [t('Summary'), t('Performance')].join(' - '); | ||
} | ||
|
||
export default withProjects(withOrganization(TransactionSpans)); |
34 changes: 34 additions & 0 deletions
34
static/app/views/performance/transactionSummary/transactionSpans/utils.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Query} from 'history'; | ||
|
||
export function generateSpansRoute({orgSlug}: {orgSlug: String}): string { | ||
return `/organizations/${orgSlug}/performance/summary/spans/`; | ||
} | ||
|
||
export function spansRouteWithQuery({ | ||
orgSlug, | ||
transaction, | ||
projectID, | ||
query, | ||
}: { | ||
orgSlug: string; | ||
transaction: string; | ||
query: Query; | ||
projectID?: string | string[]; | ||
}) { | ||
const pathname = generateSpansRoute({ | ||
orgSlug, | ||
}); | ||
|
||
return { | ||
pathname, | ||
query: { | ||
transaction, | ||
project: projectID, | ||
environment: query.environment, | ||
statsPeriod: query.statsPeriod, | ||
start: query.start, | ||
end: query.end, | ||
query: query.query, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters