Skip to content

feat(insights): add has_insights_xx span project flags #72904

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

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

KevinL10
Copy link
Contributor

Adds has_insights_xx flags for each insight module to track whether a project has sent spans for that insight module.

These flags are used to determine whether to show the empty state screen when the user visits an insight module. Our current approach involves scanning through the past 90 days of metrics data to check for any matching spans, which is extremely inefficient.

With these new project flags, we can avoid a table scan and improve insight module page load times by 2-3 seconds.

@KevinL10 KevinL10 requested review from a team as code owners June 17, 2024 21:34
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 17, 2024
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/0731_add_insight_project_flags.py ()

--
-- Alter field flags on project
--
-- (no-op)

Copy link

codecov bot commented Jun 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.05%. Comparing base (0799003) to head (339147e).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #72904      +/-   ##
==========================================
+ Coverage   73.27%   78.05%   +4.77%     
==========================================
  Files        6602     6605       +3     
  Lines      294288   294469     +181     
  Branches    50729    50759      +30     
==========================================
+ Hits       215652   229841   +14189     
+ Misses      72050    58293   -13757     
+ Partials     6586     6335     -251     
Files Coverage Δ
src/sentry/models/project.py 94.62% <100.00%> (+2.11%) ⬆️

... and 849 files with indirect coverage changes

@KevinL10 KevinL10 merged commit 7eb792b into master Jun 18, 2024
50 checks passed
@KevinL10 KevinL10 deleted the kevinliu/feat/add-has-insights-project-flags branch June 18, 2024 14:15
KevinL10 added a commit that referenced this pull request Jun 19, 2024
…72946)

A continuation of #72904.

This PR adds a signal and receiver for the `has_insights_xx_span` event,
which will trigger when the user first receives a span of a specific
insight module type.

The following PR will implement the logic that triggers the signal for
each module.
KevinL10 added a commit that referenced this pull request Jun 19, 2024
Adds logic to trigger the has_insight_xx receiver flags when a span that
matches a specific insight module is found.

Continuation of #72904
@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants