File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -3,18 +3,21 @@ import {useCallback} from 'react';
3
3
import { trackAnalytics } from 'sentry/utils/analytics' ;
4
4
import useOrganization from 'sentry/utils/useOrganization' ;
5
5
6
- export function usePaginationAnalytics ( numResults : number ) {
6
+ export function usePaginationAnalytics (
7
+ type : 'samples' | 'traces' | 'aggregates' ,
8
+ numResults : number
9
+ ) {
7
10
const organization = useOrganization ( ) ;
8
11
9
12
return useCallback (
10
13
( direction : string ) => {
11
14
trackAnalytics ( 'trace.explorer.table_pagination' , {
12
15
direction,
13
- type : 'traces' ,
16
+ type,
14
17
num_results : numResults ,
15
18
organization,
16
19
} ) ;
17
20
} ,
18
- [ organization , numResults ]
21
+ [ organization , numResults , type ]
19
22
) ;
20
23
}
Original file line number Diff line number Diff line change @@ -85,7 +85,10 @@ export function AggregatesTable({
85
85
86
86
const palette = theme . chart . getColorPalette ( numberOfRowsNeedingColor - 2 ) ; // -2 because getColorPalette artificially adds 1, I'm not sure why
87
87
88
- const paginationAnalyticsEvent = usePaginationAnalytics ( result . data ?. length ?? 0 ) ;
88
+ const paginationAnalyticsEvent = usePaginationAnalytics (
89
+ 'aggregates' ,
90
+ result . data ?. length ?? 0
91
+ ) ;
89
92
90
93
return (
91
94
< Fragment >
Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ export function SpansTable({spansTableResult}: SpansTableProps) {
62
62
const { tags : numberTags } = useSpanTags ( 'number' ) ;
63
63
const { tags : stringTags } = useSpanTags ( 'string' ) ;
64
64
65
- const paginationAnalyticsEvent = usePaginationAnalytics ( result . data ?. length ?? 0 ) ;
65
+ const paginationAnalyticsEvent = usePaginationAnalytics (
66
+ 'samples' ,
67
+ result . data ?. length ?? 0
68
+ ) ;
66
69
67
70
return (
68
71
< Fragment >
Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ export function TracesTable({tracesTableResult}: TracesTableProps) {
60
60
const showErrorState = ! isPending && isError ;
61
61
const showEmptyState = ! isPending && ! showErrorState && ( data ?. data ?. length ?? 0 ) === 0 ;
62
62
63
- const paginationAnalyticsEvent = usePaginationAnalytics ( data ?. data ?. length ?? 0 ) ;
63
+ const paginationAnalyticsEvent = usePaginationAnalytics (
64
+ 'traces' ,
65
+ data ?. data ?. length ?? 0
66
+ ) ;
64
67
65
68
return (
66
69
< Fragment >
You can’t perform that action at this time.
0 commit comments