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

feat(insights): add analytics to insight sample panels #70822

Merged
merged 9 commits into from
May 15, 2024

Conversation

KevinL10
Copy link
Contributor

@KevinL10 KevinL10 commented May 13, 2024

Continuation of #70769. Adds analytics to the span sample panel to track:

  • How often the panels are opened
  • How often spans are clicked
  • How often “Try different samples” is clicked
  • How often specific filters are interacted with

Modules to add analytics to:

  • HTTP
  • Database
  • Cache
  • Queues
  • Screen Loads
  • App Starts
  • Resources

Note: Web Vitals does not have a sample panel

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 13, 2024
Copy link

codecov bot commented May 13, 2024

Bundle Report

Changes will increase total bundle size by 2.11kB ⬆️

Bundle name Size Change
app-webpack-bundle-array-push 26.76MB 2.11kB ⬆️

@KevinL10 KevinL10 force-pushed the kevinliu/feat/sample-panel-analytics-2 branch from 066b656 to ab95284 Compare May 14, 2024 19:29
KevinL10 added a commit that referenced this pull request May 15, 2024
…odules (#70890)

Currently, the app starts module depends on `ScreenLoadSpanSamples` in
`mobile/screenload` to display the side panel. However, we therefore
cannot identify which module the panel comes from, which we will need
for analytics (e.g. # of times a sample span is clicked per module) -
#70822.

This PR moves the component under `mobile/components` and adds a
moduleName prop to identify the originating module.
@KevinL10 KevinL10 force-pushed the kevinliu/feat/sample-panel-analytics-2 branch from 2950263 to 828e976 Compare May 15, 2024 14:14
@KevinL10 KevinL10 force-pushed the kevinliu/feat/sample-panel-analytics-2 branch from a1837a7 to 594afde Compare May 15, 2024 14:37
@KevinL10 KevinL10 marked this pull request as ready for review May 15, 2024 14:37
@KevinL10 KevinL10 requested a review from a team as a code owner May 15, 2024 14:37
Copy link
Member

@narsaynorath narsaynorath left a comment

Choose a reason for hiding this comment

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

Just some small nits and questions because I'm a little unfamiliar with some of the constants you modified

Comment on lines +164 to +170
onClick={() =>
trackAnalytics('performance_views.sample_spans.opened', {
organization,
source: ModuleName.APP_START,
})
}
to={`${pathname}?${qs.stringify(query)}`}
Copy link
Member

Choose a reason for hiding this comment

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

An alternative I'm curious about is if we'd be able to instrument this in the panel itself since you're already passing along the module name. e.g. in a useEffect hook that just runs once when it's rendered unless for some reason that won't work with how we've set up the panel

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think we can for all of the modules

Comment on lines +108 to +109
screen_load: t('Action'),
app_start: t('Action'),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
screen_load: t('Action'),
app_start: t('Action'),
screenLoad: t('Action'),
appStart: t('Action'),

Also, maybe I'm missing context but what are these used for? 🤔

Comment on lines +176 to +177
screen_load: t('Domain'),
app_start: t('Domain'),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
screen_load: t('Domain'),
app_start: t('Domain'),
screenLoad: t('Domain'),
appStart: t('Domain'),

Similar to my other comment, I'm not exactly sure what's being mapped here to use the Domain string

Copy link
Contributor Author

@KevinL10 KevinL10 May 15, 2024

Choose a reason for hiding this comment

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

These values are used as labels for some specific dropdowns in http and db modules (see "SQL Command" and "Table" in Queries module - screenshot). They aren't used for the remaining modules, but are required in this constant due to the {[key in ModuleName]: ReactNode} typing. I included default Action and Domain values for these remaining modules.

image

Copy link
Member

Choose a reason for hiding this comment

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

I see, that's kind of annoying that you had to make this change. I say we can fix the typing here later so we don't have to update this list every time we add a new module but I'm fine with keeping it as-is for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, will see if I can fix that in the follow up when I move instrumentation to the panel itself

@KevinL10 KevinL10 merged commit 7fbe058 into master May 15, 2024
40 of 41 checks passed
@KevinL10 KevinL10 deleted the kevinliu/feat/sample-panel-analytics-2 branch May 15, 2024 20:16
cmanallen pushed a commit that referenced this pull request May 21, 2024
Continuation of #70769. Adds
analytics to the span sample panel to track:
- How often the panels are opened
- How often spans are clicked
- How often “Try different samples” is clicked
- How often specific filters are interacted with

Modules to add analytics to:
- [x] HTTP
- [x] Database
- [x] Cache
- [x] Queues
- [x] Screen Loads
- [x] App Starts
- [x] Resources

Note: Web Vitals does not have a sample panel

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants