Skip to content

Commit

Permalink
feat(flags): add has_flags to project (#83198)
Browse files Browse the repository at this point in the history
relates to getsentry/team-replay#499

This flag will be used to check whether the project has sent feature
flags. We will use this information on the frontend to determine when to
display an onboarding CTA.
  • Loading branch information
michellewzhang authored Jan 9, 2025
1 parent d6a411b commit 808582c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ remote_subscriptions: 0003_drop_remote_subscription

replays: 0004_index_together

sentry: 0809_delete_auth_provider_default_teams
sentry: 0810_add_project_has_flag

social_auth: 0002_default_auto_field

Expand Down
67 changes: 67 additions & 0 deletions src/sentry/migrations/0810_add_project_has_flag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Generated by Django 5.1.4 on 2025-01-09 20:33

from django.db import migrations

import bitfield.models
from sentry.new_migrations.migrations import CheckedMigration


class Migration(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# of a table.
# Here are some things that make sense to mark as post deployment:
# - Large data migrations. Typically we want these to be run manually so that they can be
# monitored and not block the deploy for a long period of time while they run.
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
# run this outside deployments so that we don't block them. Note that while adding an index
# is a schema change, it's completely safe to run the operation after the code has deployed.
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment

is_post_deployment = False

dependencies = [
("sentry", "0809_delete_auth_provider_default_teams"),
]

operations = [
migrations.AlterField(
model_name="project",
name="flags",
field=bitfield.models.BitField(
[
"has_releases",
"has_issue_alerts_targeting",
"has_transactions",
"has_alert_filters",
"has_sessions",
"has_profiles",
"has_replays",
"has_feedbacks",
"has_new_feedbacks",
"spike_protection_error_currently_active",
"spike_protection_transaction_currently_active",
"spike_protection_attachment_currently_active",
"has_minified_stack_trace",
"has_cron_monitors",
"has_cron_checkins",
"has_sourcemaps",
"has_custom_metrics",
"has_high_priority_alerts",
"has_insights_http",
"has_insights_db",
"has_insights_assets",
"has_insights_app_start",
"has_insights_screen_load",
"has_insights_vitals",
"has_insights_caches",
"has_insights_queues",
"has_insights_llm_monitoring",
"has_flags",
],
default=10,
null=True,
),
),
]
3 changes: 3 additions & 0 deletions src/sentry/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ class flags(TypedClassBitField):
# This Project has sent insight llm monitoring spans
has_insights_llm_monitoring: bool

# This Project has sent feature flags
has_flags: bool

bitfield_default = 10
bitfield_null = True

Expand Down

0 comments on commit 808582c

Please sign in to comment.