-
-
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
Changes from all commits
c31c529
805eb7b
dcab3fd
6013c24
96e73f1
f0b108d
e394cb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| ) | ||
| from sentry.seer.signed_seer_api import make_signed_seer_api_request, sign_with_seer_secret | ||
| from sentry.utils import json | ||
| from sentry.utils.cache import cache | ||
| from sentry.utils.outcomes import Outcome, track_outcome | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
@@ -364,6 +365,30 @@ def is_seer_scanner_rate_limited(project: Project, organization: Organization) - | |
| return is_rate_limited | ||
|
|
||
|
|
||
| def get_seer_seat_based_tier_cache_key(organization_id: int) -> str: | ||
| """Get the cache key for seat-based Seer tier check.""" | ||
| return f"seer:seat-based-tier:{organization_id}" | ||
|
|
||
|
|
||
| def is_seer_seat_based_tier_enabled(organization: Organization) -> bool: | ||
| """ | ||
| Check if organization has Seer seat-based pricing via billing. | ||
| """ | ||
| if features.has("organizations:triage-signals-v0-org", organization): | ||
| return True | ||
|
|
||
| cache_key = get_seer_seat_based_tier_cache_key(organization.id) | ||
| cached_value = cache.get(cache_key) | ||
| if cached_value is not None: | ||
| return cached_value | ||
|
|
||
| logger.info("Checking if seat-based Seer tier is enabled for organization=%s", organization.id) | ||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we have to make the TTL so long?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we building cache invalidation into the sign up flow then?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I can add it there.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added it in the sign up task. |
||
|
|
||
| return has_seat_based_seer | ||
|
|
||
|
|
||
| def is_issue_eligible_for_seer_automation(group: Group) -> bool: | ||
| """Check if Seer automation is allowed for a given group based on permissions and issue type.""" | ||
| from sentry import quotas | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.