Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(issue-details): Add analytics about sidebar/sections #80766

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions static/app/views/issueDetails/groupDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ import GroupEventDetails from 'sentry/views/issueDetails/groupEventDetails/group
import {useGroupTagsDrawer} from 'sentry/views/issueDetails/groupTags/useGroupTagsDrawer';
import GroupHeader from 'sentry/views/issueDetails/header';
import SampleEventAlert from 'sentry/views/issueDetails/sampleEventAlert';
import {SectionKey} from 'sentry/views/issueDetails/streamline/context';
import {getFoldSectionKey} from 'sentry/views/issueDetails/streamline/foldSection';
import {GroupDetailsLayout} from 'sentry/views/issueDetails/streamline/groupDetailsLayout';
import {useMergedIssuesDrawer} from 'sentry/views/issueDetails/streamline/useMergedIssuesDrawer';
import {useSimilarIssuesDrawer} from 'sentry/views/issueDetails/streamline/useSimilarIssuesDrawer';
Expand Down Expand Up @@ -474,6 +476,31 @@ function useLoadedEventType() {
}
}

interface StreamlinedUIAnalyticsData {
fold_sections_open?: string;
sidebar_open?: boolean;
}
function useGetAnalyticsDataStreamlinedUI(): StreamlinedUIAnalyticsData {
const hasStreamlinedUI = useHasStreamlinedUI();
if (!hasStreamlinedUI) {
return {};
}

const sidebarOpenSections: Record<string, boolean> = {};
for (const sectionKey of Object.values(SectionKey)) {
const foldSectionKey = getFoldSectionKey(sectionKey);
const isOpen = localStorage.getItem(foldSectionKey) === 'true';
if (isOpen) {
sidebarOpenSections[`sidebar_${sectionKey}_open`] = true;
}
}

return {
sidebar_open: localStorage.getItem('issue-details-sidebar-open') === 'true',
...sidebarOpenSections,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing it this way because we can't really send an array over and if we sent an individual event for each section open it would be too many events

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't feel like this will be valuable to me since it also depends on if the page even has those sections

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh its just the sidebar

};
}

function useTrackView({
group,
event,
Expand All @@ -496,6 +523,7 @@ function useTrackView({
...getAnalyticsDataForGroup(group),
...getAnalyticsDataForEvent(event),
...getAnalyicsDataForProject(project),
...useGetAnalyticsDataStreamlinedUI(),
tab,
stream_index: typeof stream_index === 'string' ? Number(stream_index) : undefined,
query: typeof query === 'string' ? query : undefined,
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/issueDetails/streamline/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useReducer,
} from 'react';

export const enum SectionKey {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are these in the sidebar?

export enum SectionKey {
/**
* Trace timeline or linked error
*/
Expand Down
Loading