Browse Source

feat(sessions): Remove unused sessions ingestion feature flags (#69860)

Relay can no longer ingest sessions into Kafka after
https://github.com/getsentry/relay/pull/3271 making these feature flags
obsolete.

See also: https://github.com/getsentry/relay/issues/3368 and
https://github.com/getsentry/relay/issues/3492
David Herberth 10 months ago
parent
commit
86c42b2d21

+ 0 - 1
src/sentry/apidocs/examples/project_examples.py

@@ -185,7 +185,6 @@ DETAILED_PROJECT = {
             "mep-rollout-flag",
             "performance-issues-m-n-plus-one-db-detector",
             "session-replay-ui",
-            "release-health-drop-sessions",
             "alert-crash-free-metrics",
             "performance-n-plus-one-db-queries-visible",
             "session-replay-recording-scrubbing",

+ 0 - 4
src/sentry/conf/server.py

@@ -1660,8 +1660,6 @@ SENTRY_FEATURES: dict[str, bool | None] = {
     "organizations:metric-alert-threshold-period": False,
     # Enables the metrics metadata.
     "organizations:metric-meta": False,
-    # Extract metrics for sessions during ingestion.
-    "organizations:metrics-extraction": False,
     # Enables the ability to block metrics.
     "organizations:metrics-blocking": False,
     # Enables the search bar for metrics samples list
@@ -1818,8 +1816,6 @@ SENTRY_FEATURES: dict[str, bool | None] = {
     "organizations:relay-cardinality-limiter": False,
     # Enable the release details performance section
     "organizations:release-comparison-performance": False,
-    # True if Relay should drop raw session payloads after extracting metrics from them.
-    "organizations:release-health-drop-sessions": False,
     # Enable new release UI
     "organizations:releases-v2": False,
     "organizations:releases-v2-banner": False,

+ 0 - 2
src/sentry/features/temporary.py

@@ -109,7 +109,6 @@ def register_temporary_features(manager: FeatureManager):
     manager.add("organizations:metric-alert-threshold-period", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
     manager.add("organizations:metric-meta", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
     manager.add("organizations:metrics-blocking", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
-    manager.add("organizations:metrics-extraction", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
     manager.add("organizations:metrics-samples-list-search", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
     manager.add("organizations:minute-resolution-sessions", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
     manager.add("organizations:mobile-cpu-memory-in-transactions", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
@@ -187,7 +186,6 @@ def register_temporary_features(manager: FeatureManager):
     manager.add("organizations:related-issues", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
     manager.add("organizations:relay-cardinality-limiter", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
     manager.add("organizations:release-comparison-performance", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
-    manager.add("organizations:release-health-drop-sessions", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
     manager.add("organizations:releases-v2", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
     manager.add("organizations:releases-v2-banner", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
     manager.add("organizations:releases-v2-internal", OrganizationFeature, FeatureHandlerStrategy.REMOTE)

+ 7 - 8
src/sentry/relay/config/__init__.py

@@ -819,14 +819,13 @@ def _get_project_config(
 
         add_experimental_config(config, "metricExtraction", get_metric_extraction_config, project)
 
-    if features.has("organizations:metrics-extraction", project.organization):
-        config["sessionMetrics"] = {
-            "version": (
-                EXTRACT_ABNORMAL_MECHANISM_VERSION
-                if _should_extract_abnormal_mechanism(project)
-                else EXTRACT_METRICS_VERSION
-            ),
-        }
+    config["sessionMetrics"] = {
+        "version": (
+            EXTRACT_ABNORMAL_MECHANISM_VERSION
+            if _should_extract_abnormal_mechanism(project)
+            else EXTRACT_METRICS_VERSION
+        ),
+    }
 
     performance_score_profiles = [
         *_get_browser_performance_profiles(project.organization),

+ 16 - 21
tests/sentry/api/endpoints/test_relay_projectconfigs_v2.py

@@ -346,18 +346,14 @@ def test_relay_disabled_key(
 
 
 @django_db_all
-@pytest.mark.parametrize("drop_sessions", [False, True])
-def test_session_metrics_extraction(call_endpoint, task_runner, drop_sessions):
-    with Feature({"organizations:metrics-extraction": True}), Feature(
-        {"organizations:release-health-drop-sessions": drop_sessions}
-    ):
-        with task_runner():
-            result, status_code = call_endpoint(full_config=True)
-            assert status_code < 400
+def test_session_metrics_extraction(call_endpoint, task_runner):
+    with task_runner():
+        result, status_code = call_endpoint(full_config=True)
+        assert status_code < 400
 
-        for config in result["configs"].values():
-            config = config["config"]
-            assert config["sessionMetrics"] == {"version": 1}
+    for config in result["configs"].values():
+        config = config["config"]
+        assert config["sessionMetrics"] == {"version": 1}
 
 
 @django_db_all
@@ -369,13 +365,12 @@ def test_session_metrics_abnormal_mechanism_tag_extraction(
         "sentry-metrics.releasehealth.abnormal-mechanism-extraction-rate",
         abnormal_mechanism_rollout,
     ):
-        with Feature({"organizations:metrics-extraction": True}):
-            with task_runner():
-                result, status_code = call_endpoint(full_config=True)
-                assert status_code < 400
-
-            for config in result["configs"].values():
-                config = config["config"]
-                assert config["sessionMetrics"] == {
-                    "version": 2 if abnormal_mechanism_rollout else 1,
-                }
+        with task_runner():
+            result, status_code = call_endpoint(full_config=True)
+            assert status_code < 400
+
+        for config in result["configs"].values():
+            config = config["config"]
+            assert config["sessionMetrics"] == {
+                "version": 2 if abnormal_mechanism_rollout else 1,
+            }

+ 4 - 0
tests/sentry/relay/snapshots/test_config/test_get_project_config/full_config/REGION.pysnap

@@ -1,4 +1,6 @@
 ---
+created: '2024-04-30T11:46:28.288534+00:00'
+creator: sentry
 source: tests/sentry/relay/test_config.py
 ---
 config:
@@ -292,6 +294,8 @@ config:
         - '@ip'
         - '@mac'
         type: multiple
+  sessionMetrics:
+    version: 1
   trustedRelays: []
 disabled: false
 slug: bar

+ 5 - 10
tests/sentry/relay/test_config.py

@@ -480,27 +480,22 @@ def test_project_config_with_breakdown(default_project, insta_snapshot, transact
 
 @django_db_all
 @region_silo_test
-@pytest.mark.parametrize("has_metrics_extraction", (True, False))
 @pytest.mark.parametrize("abnormal_mechanism_rollout", (0, 1))
 def test_project_config_with_organizations_metrics_extraction(
-    default_project, set_sentry_option, abnormal_mechanism_rollout, has_metrics_extraction
+    default_project, set_sentry_option, abnormal_mechanism_rollout
 ):
     with set_sentry_option(
         "sentry-metrics.releasehealth.abnormal-mechanism-extraction-rate",
         abnormal_mechanism_rollout,
     ):
-        with Feature({"organizations:metrics-extraction": has_metrics_extraction}):
-            project_cfg = get_project_config(default_project, full_config=True)
+        project_cfg = get_project_config(default_project, full_config=True)
 
         cfg = project_cfg.to_dict()
         _validate_project_config(cfg["config"])
         session_metrics = get_path(cfg, "config", "sessionMetrics")
-        if has_metrics_extraction:
-            assert session_metrics == {
-                "version": 2 if abnormal_mechanism_rollout else 1,
-            }
-        else:
-            assert session_metrics is None
+        assert session_metrics == {
+            "version": 2 if abnormal_mechanism_rollout else 1,
+        }
 
 
 @django_db_all