diff --git a/src/sentry/relay/config/__init__.py b/src/sentry/relay/config/__init__.py index a170d6621074..017942e1fce7 100644 --- a/src/sentry/relay/config/__init__.py +++ b/src/sentry/relay/config/__init__.py @@ -849,7 +849,11 @@ def _get_project_config( with traces.start_span( name="get_exposed_features", attributes={"sentry.op": "get_exposed_features"} ): - if exposed_features := get_exposed_features(project): + exposed_features = list(get_exposed_features(project)) + if project.get_option("sentry:relay_automatic_json_expansion"): + # This is a project option encoded as a feature, not an actual project flag. + exposed_features.append("projects:relay-automatic-json-expansion") + if exposed_features: config["features"] = exposed_features # NOTE: Omitting dynamicSampling because of a failure increases the number diff --git a/tests/sentry/relay/test_config.py b/tests/sentry/relay/test_config.py index ffa25ea8d148..14ec34a869da 100644 --- a/tests/sentry/relay/test_config.py +++ b/tests/sentry/relay/test_config.py @@ -296,6 +296,21 @@ def test_project_config_custom_inbound_filters_v2( assert custom_filters == [] +@django_db_all +@cell_silo_test +@pytest.mark.parametrize("option_enabled", [True, False]) +def test_project_config_json_expansion(default_project: MagicMock, option_enabled: bool) -> None: + default_project.update_option("sentry:relay_automatic_json_expansion", option_enabled) + + project_cfg = get_project_config(default_project) + + cfg = project_cfg.to_dict() + _validate_project_config(cfg["config"]) + exposed_features = get_path(cfg, "config", "features") or [] + + assert ("projects:relay-automatic-json-expansion" in exposed_features) == option_enabled + + @django_db_all @cell_silo_test @mock.patch("sentry.relay.config.EXPOSABLE_FEATURES", ["organizations:profiling"])