Skip to content

Commit 8a12a05

Browse files
authored
ref(tracemetrics): Reduce analytic events firing (#102972)
### Summary Need to update them to only fire once per dep updates, and not on empty content.
1 parent 0ecd4cb commit 8a12a05

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

static/app/views/explore/hooks/useAnalytics.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ export function useMetricsPanelAnalytics({
740740
return;
741741
}
742742

743-
if (metricSamplesTableResult.result.isFetching) {
743+
if (metricSamplesTableResult.result.isFetching || !dataScanned) {
744744
return;
745745
}
746746

static/app/views/nav/secondary/sections/explore/exploreSecondaryNav.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,25 @@ export function ExploreSecondaryNav() {
3030
perPage: MAX_STARRED_QUERIES_DISPLAYED,
3131
});
3232

33+
const userPlatforms = useMemo(
34+
() =>
35+
Array.from(
36+
new Set(projects.map(project => (project.platform as PlatformKey) || 'unknown'))
37+
).sort(),
38+
[projects]
39+
);
40+
3341
const hasMetricsSupportedPlatform = projects.some(project => {
3442
const platform = project.platform || 'unknown';
3543
return Array.from(limitedMetricsSupportPrefixes).some(prefix =>
3644
platform.startsWith(prefix)
3745
);
3846
});
3947

40-
const userPlatforms = useMemo(
41-
() => [
42-
...new Set(projects.map(project => (project.platform as PlatformKey) || 'unknown')),
43-
],
44-
[projects]
45-
);
46-
4748
useEffect(() => {
49+
if (userPlatforms.length === 0) {
50+
return;
51+
}
4852
trackAnalytics('metrics.nav.rendered', {
4953
organization,
5054
metrics_tab_visible: hasMetricsSupportedPlatform,

0 commit comments

Comments
 (0)