Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/sentry/relay/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Comment on lines +852 to +856

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: You could probably write a small FeatureHandler that turns the option into a feature to make this less ad-hoc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call but I'll probably leave that as an exercise to the reader if anyone ever ends up with this flow again (seems unlikely since this is the first in a very long time)

config["features"] = exposed_features

# NOTE: Omitting dynamicSampling because of a failure increases the number
Expand Down
15 changes: 15 additions & 0 deletions tests/sentry/relay/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
Loading