File tree 3 files changed +24
-3
lines changed
static/app/views/performance/newTraceDetails
3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import useOrganization from 'sentry/utils/useOrganization';
12
12
import { AttributesTree } from 'sentry/views/explore/components/traceItemAttributes/attributesTree' ;
13
13
import type { TraceRootEventQueryResults } from 'sentry/views/performance/newTraceDetails/traceApi/useTraceRootEvent' ;
14
14
import { isTraceItemDetailsResponse } from 'sentry/views/performance/newTraceDetails/traceApi/utils' ;
15
+ import { sortAttributes } from 'sentry/views/performance/newTraceDetails/traceDrawer/details/utils' ;
15
16
import { useHasTraceTabsUI } from 'sentry/views/performance/newTraceDetails/useHasTraceTabsUI' ;
16
17
17
18
type Props = {
@@ -35,7 +36,7 @@ export function TraceContextTags({rootEventResults}: Props) {
35
36
const eventDetails = rootEventResults . data ! ;
36
37
const rendered = isTraceItemDetailsResponse ( eventDetails ) ? (
37
38
< AttributesTree
38
- attributes = { eventDetails . attributes }
39
+ attributes = { sortAttributes ( eventDetails . attributes ) }
39
40
rendererExtra = { {
40
41
theme,
41
42
location,
Original file line number Diff line number Diff line change @@ -37,7 +37,10 @@ import {FoldSection} from 'sentry/views/issueDetails/streamline/foldSection';
37
37
import { InterimSection } from 'sentry/views/issueDetails/streamline/interimSection' ;
38
38
import { IssueList } from 'sentry/views/performance/newTraceDetails/traceDrawer/details/issues/issues' ;
39
39
import { TraceDrawerComponents } from 'sentry/views/performance/newTraceDetails/traceDrawer/details/styles' ;
40
- import { getProfileMeta } from 'sentry/views/performance/newTraceDetails/traceDrawer/details/utils' ;
40
+ import {
41
+ getProfileMeta ,
42
+ sortAttributes ,
43
+ } from 'sentry/views/performance/newTraceDetails/traceDrawer/details/utils' ;
41
44
import type { TraceTreeNodeDetailsProps } from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails' ;
42
45
import { isEAPSpanNode } from 'sentry/views/performance/newTraceDetails/traceGuards' ;
43
46
import type { TraceTree } from 'sentry/views/performance/newTraceDetails/traceModels/traceTree' ;
@@ -390,7 +393,7 @@ function EAPSpanNodeDetails({
390
393
>
391
394
< AttributesTree
392
395
columnCount = { columnCount }
393
- attributes = { attributes }
396
+ attributes = { sortAttributes ( attributes ) }
394
397
rendererExtra = { {
395
398
theme,
396
399
location,
Original file line number Diff line number Diff line change @@ -82,3 +82,20 @@ export function findSpanAttributeValue(
82
82
) {
83
83
return attributes . find ( attribute => attribute . name === attributeName ) ?. value . toString ( ) ;
84
84
}
85
+
86
+ // Sort attributes so that span.* attributes are at the beginning and
87
+ // the rest of the attributes are sorted alphabetically.
88
+ export function sortAttributes ( attributes : TraceItemResponseAttribute [ ] ) {
89
+ return [ ...attributes ] . sort ( ( a , b ) => {
90
+ const aIsSpan = a . name . startsWith ( 'span.' ) ;
91
+ const bIsSpan = b . name . startsWith ( 'span.' ) ;
92
+
93
+ if ( aIsSpan && ! bIsSpan ) {
94
+ return - 1 ;
95
+ }
96
+ if ( ! aIsSpan && bIsSpan ) {
97
+ return 1 ;
98
+ }
99
+ return a . name . localeCompare ( b . name ) ;
100
+ } ) ;
101
+ }
You can’t perform that action at this time.
0 commit comments