Skip to content

Commit

Permalink
feat(sessions): Remove unused sessions ingestion feature flags (#69860)
Browse files Browse the repository at this point in the history
Relay can no longer ingest sessions into Kafka after
getsentry/relay#3271 making these feature flags
obsolete.

See also: getsentry/relay#3368 and
getsentry/relay#3492
  • Loading branch information
Dav1dde committed Apr 30, 2024
1 parent 56a0e07 commit 86c42b2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 46 deletions.
1 change: 0 additions & 1 deletion src/sentry/apidocs/examples/project_examples.py
Expand Up @@ -185,7 +185,6 @@
"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",
Expand Down
4 changes: 0 additions & 4 deletions src/sentry/conf/server.py
Expand Up @@ -1660,8 +1660,6 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
"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
Expand Down Expand Up @@ -1818,8 +1816,6 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
"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,
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/features/temporary.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 7 additions & 8 deletions src/sentry/relay/config/__init__.py
Expand Up @@ -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),
Expand Down
37 changes: 16 additions & 21 deletions tests/sentry/api/endpoints/test_relay_projectconfigs_v2.py
Expand Up @@ -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
Expand 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,
}
@@ -1,4 +1,6 @@
---
created: '2024-04-30T11:46:28.288534+00:00'
creator: sentry
source: tests/sentry/relay/test_config.py
---
config:
Expand Down Expand Up @@ -292,6 +294,8 @@ config:
- '@ip'
- '@mac'
type: multiple
sessionMetrics:
version: 1
trustedRelays: []
disabled: false
slug: bar
15 changes: 5 additions & 10 deletions tests/sentry/relay/test_config.py
Expand Up @@ -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
Expand Down

0 comments on commit 86c42b2

Please sign in to comment.