Skip to content

Commit ab95284

Browse files
committed
add analytics to cache sample panel
1 parent 716a276 commit ab95284

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

static/app/views/performance/cache/samplePanel/samplePanel.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {Button} from 'sentry/components/button';
88
import Link from 'sentry/components/links/link';
99
import {t} from 'sentry/locale';
1010
import {space} from 'sentry/styles/space';
11+
import {trackAnalytics} from 'sentry/utils/analytics';
1112
import {DurationUnit, RateUnit, SizeUnit} from 'sentry/utils/discover/fields';
1213
import {PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
1314
import {decodeScalar} from 'sentry/utils/queryString';
@@ -34,6 +35,7 @@ import {useTransactions} from 'sentry/views/starfish/queries/useTransactions';
3435
import {
3536
MetricsFields,
3637
type MetricsQueryFilters,
38+
ModuleName,
3739
SpanFunction,
3840
SpanIndexedField,
3941
type SpanIndexedQueryFilters,
@@ -346,7 +348,17 @@ export function CacheSamplePanel() {
346348

347349
<Fragment>
348350
<ModuleLayout.Full>
349-
<Button onClick={handleRefetch}>{t('Try Different Samples')}</Button>
351+
<Button
352+
onClick={() => {
353+
trackAnalytics(
354+
'performance_views.sample_spans.try_different_samples_clicked',
355+
{organization, source: ModuleName.CACHE}
356+
);
357+
handleRefetch();
358+
}}
359+
>
360+
{t('Try Different Samples')}
361+
</Button>
350362
</ModuleLayout.Full>
351363
</Fragment>
352364
</ModuleLayout.Layout>

static/app/views/performance/cache/tables/transactionCell.tsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import * as qs from 'query-string';
22

33
import Link from 'sentry/components/links/link';
4+
import {trackAnalytics} from 'sentry/utils/analytics';
45
import {useLocation} from 'sentry/utils/useLocation';
6+
import useOrganization from 'sentry/utils/useOrganization';
57
import {useCacheUrl} from 'sentry/views/performance/cache/utils';
68
import {OverflowEllipsisTextContainer} from 'sentry/views/starfish/components/textAlign';
9+
import {ModuleName} from 'sentry/views/starfish/types';
710

811
interface Props {
912
project?: string;
@@ -12,6 +15,7 @@ interface Props {
1215
}
1316

1417
export function TransactionCell({project, transaction}: Props) {
18+
const organization = useOrganization();
1519
const location = useLocation();
1620
const cacheUrl = useCacheUrl();
1721

@@ -27,7 +31,17 @@ export function TransactionCell({project, transaction}: Props) {
2731

2832
return (
2933
<OverflowEllipsisTextContainer>
30-
<Link to={`${cacheUrl}/?${qs.stringify(query)}`}>{transaction}</Link>
34+
<Link
35+
onClick={() =>
36+
trackAnalytics('performance_views.sample_spans.opened', {
37+
organization,
38+
source: ModuleName.CACHE,
39+
})
40+
}
41+
to={`${cacheUrl}/?${qs.stringify(query)}`}
42+
>
43+
{transaction}
44+
</Link>
3145
</OverflowEllipsisTextContainer>
3246
);
3347
}

0 commit comments

Comments
 (0)