-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(triage signals): Use new seat based pricing feature flag #104528
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #104528 +/- ##
=========================================
Coverage 80.52% 80.53%
=========================================
Files 9352 9352
Lines 400377 400547 +170
Branches 25696 25696
=========================================
+ Hits 322389 322561 +172
+ Misses 77538 77536 -2
Partials 450 450 |
| return cached_value | ||
|
|
||
| has_seat_based_seer = features.has("organizations:seat-based-seer-enabled", organization) | ||
| cache.set(cache_key, has_seat_based_seer, timeout=60 * 60 * 4) # 4 hours TTL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have to make the TTL so long?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particularly strong reason. This is a flag that's set when an org signs up for the new Seer pricing so I don't expect it to change very often.
Also longer the TTL more cache hits, but the tradeoff is cache staleness. So if an orgs gets off for new pricing the new automation logic still will be enabled for 4 extra hours which seems fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we building cache invalidation into the sign up flow then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I can add it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it in the sign up task.
8577fe7 to
96e73f1
Compare
src/sentry/tasks/autofix.py
Outdated
| bulk_set_project_preferences(organization_id, preferences_to_set) | ||
|
|
||
| # Invalidate seat-based tier cache so new settings take effect immediately | ||
| cache.delete(get_seer_seat_based_tier_cache_key(organization_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we need to add tests for this file to ensure that the cache gets invalidated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I can add a test for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the test.
## PR Details + Added a new function to check for the triage-signals or the [billing feature flag in getsentry](https://github.com/getsentry/getsentry/blob/af9c348984e21886e0067ff5e8df9ad94489af1e/getsentry/features.py#L1915) to check if the org has signed up for new billing. + The function also caches the billing flag value since we want to reduce the number of DB reads. This function will later be used in `kick_off_seer_autoamtion` which is called for every event in every issue! + Just called this function once with a try catch to check that it works as expected. If there are no issues I will remove the try-except and replace all instances of the `features.has("organizations:triage-signals-v0-org")` check with this function. + Added cache invalidation when orgs sign up for the new billing.
…104570) ## PR Details + Replace direct `features.has("organizations:triage-signals-v0-org")` checks with `is_seer_seat_based_tier_enabled()` across all triage signals code paths. + Already tested it out on s amller scale with this PR that just added it in 1 place: #104528. Logs are [here](https://sentry.sentry.io/explore/logs/?logsFields=timestamp&logsFields=message&logsFields=server.address&logsFields=group_id&logsFields=project&logsQuery=message%3A%EF%80%8DContains%EF%80%8D%5B%22Error%20checking%20if%20seat-based%20Seer%20tier%20is%20enabled%22%2C%22Checking%20if%20seat-based%20Seer%20tier%20is%20enabled%20for%20organization%22%5D&logsSortBys=-timestamp&mode=samples&project=1&statsPeriod=2h). No failure logs yet. ### Changes + **`issue_summary.py`**: Updated `run_automation()` to use `is_seer_seat_based_tier_enabled()` for both the ALERT event count check and the stopping point logic + **`similarity/utils.py`**: Updated `set_default_project_autofix_automation_tuning()` and `set_default_project_seer_scanner_automation()` to use `is_seer_seat_based_tier_enabled()` + **`post_process.py`**: Updated `kick_off_seer_automation()` to use `is_seer_seat_based_tier_enabled()` ### Why The `is_seer_seat_based_tier_enabled()` function checks both: 1. The existing `organizations:triage-signals-v0-org` feature flag 2. The new `organizations:seat-based-seer-enabled` billing flag (with caching) This allows triage signals features to work for organizations with either the feature flag OR the seat-based billing tier enabled.
PR Details
kick_off_seer_autoamtionwhich is called for every event in every issue!features.has("organizations:triage-signals-v0-org")check with this function.