Skip to content

Conversation

@Mihir-Mavalankar
Copy link
Contributor

@Mihir-Mavalankar Mihir-Mavalankar commented Dec 8, 2025

PR Details

  • Added a new function to check for the triage-signals or the billing feature flag in getsentry 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.

@Mihir-Mavalankar Mihir-Mavalankar self-assigned this Dec 8, 2025
@Mihir-Mavalankar Mihir-Mavalankar requested a review from a team as a code owner December 8, 2025 18:37
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 8, 2025
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/seer/autofix/issue_summary.py 50.00% 3 Missing ⚠️
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
Copy link
Member

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?

Copy link
Contributor Author

@Mihir-Mavalankar Mihir-Mavalankar Dec 8, 2025

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

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))
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the test.

@Mihir-Mavalankar Mihir-Mavalankar merged commit 895ad88 into master Dec 8, 2025
67 checks passed
@Mihir-Mavalankar Mihir-Mavalankar deleted the add-billing-flag-triage-signals branch December 8, 2025 23:42
ryan953 pushed a commit that referenced this pull request Dec 9, 2025
## 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.
Mihir-Mavalankar added a commit that referenced this pull request Dec 9, 2025
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants