Skip to content

Commit 2e90ca4

Browse files
authored
ref(relay): Remove transaction extraction config (#112663)
Removed in getsentry/relay#5792
1 parent de1e19f commit 2e90ca4

File tree

6 files changed

+0
-150
lines changed

6 files changed

+0
-150
lines changed

src/sentry/relay/config/__init__.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from typing import Any, Literal, TypedDict
88

99
import sentry_sdk
10-
from sentry_sdk import capture_exception
1110

1211
from sentry import features, killswitches, options, quotas, utils
1312
from sentry.constants import (
@@ -50,8 +49,6 @@
5049
from sentry.utils.http import get_origins
5150
from sentry.utils.options import sample_modulo
5251

53-
from .measurements import CUSTOM_MEASUREMENT_LIMIT
54-
5552
# These features will be listed in the project config.
5653
EXPOSABLE_FEATURES = [
5754
"organizations:continuous-profiling",
@@ -948,14 +945,6 @@ def _get_project_config(
948945
config["breakdownsV2"] = project.get_option("sentry:breakdowns")
949946

950947
if _should_extract_transaction_metrics(project):
951-
add_experimental_config(
952-
config,
953-
"transactionMetrics",
954-
get_transaction_metrics_settings,
955-
project,
956-
config.get("breakdownsV2"),
957-
)
958-
959948
# This config key is technically not specific to _transaction_ metrics,
960949
# is however currently both only applied to transaction metrics in
961950
# Relay, and only used to tag transaction metrics in Sentry.
@@ -1184,67 +1173,9 @@ def _filter_option_to_config_setting(flt: _FilterSpec, setting: str) -> Mapping[
11841173
return ret_val
11851174

11861175

1187-
#: Version of the transaction metrics extraction.
1188-
#: When you increment this version, outdated Relays will stop extracting
1189-
#: transaction metrics.
1190-
#: See https://github.com/getsentry/relay/blob/6181c6e80b9485ed394c40bc860586ae934704e2/relay-dynamic-config/src/metrics.rs#L85
1191-
TRANSACTION_METRICS_EXTRACTION_VERSION = 6
1192-
1193-
1194-
class CustomMeasurementSettings(TypedDict):
1195-
limit: int
1196-
1197-
1198-
TransactionNameStrategy = Literal["strict", "clientBased"]
1199-
1200-
1201-
class TransactionMetricsSettings(TypedDict):
1202-
version: int
1203-
extractCustomTags: list[str]
1204-
customMeasurements: CustomMeasurementSettings
1205-
acceptTransactionNames: TransactionNameStrategy
1206-
1207-
12081176
def _should_extract_transaction_metrics(project: Project) -> bool:
12091177
return features.has(
12101178
"organizations:transaction-metrics-extraction", project.organization
12111179
) and not killswitches.killswitch_matches_context(
12121180
"relay.drop-transaction-metrics", {"project_id": project.id}
12131181
)
1214-
1215-
1216-
def get_transaction_metrics_settings(
1217-
timeout: TimeChecker, project: Project, breakdowns_config: Mapping[str, Any] | None
1218-
) -> TransactionMetricsSettings:
1219-
"""This function assumes that the corresponding feature flag has been checked.
1220-
See _should_extract_transaction_metrics.
1221-
"""
1222-
custom_tags: list[str] = []
1223-
1224-
if breakdowns_config is not None:
1225-
# we already have a breakdown configuration that tells relay which
1226-
# breakdowns to compute for an event. metrics extraction should
1227-
# probably be in sync with that, or at least not extract more metrics
1228-
# than there are breakdowns configured.
1229-
try:
1230-
for _, breakdown_config in breakdowns_config.items():
1231-
assert breakdown_config["type"] == "spanOperations"
1232-
1233-
except Exception:
1234-
capture_exception()
1235-
1236-
# Tells relay which user-defined tags to add to each extracted
1237-
# transaction metric. This cannot include things such as `os.name`
1238-
# which are computed on the server, they have to come from the SDK as
1239-
# event tags.
1240-
try:
1241-
custom_tags.extend(project.get_option("sentry:transaction_metrics_custom_tags") or ())
1242-
except Exception:
1243-
capture_exception()
1244-
1245-
return {
1246-
"version": TRANSACTION_METRICS_EXTRACTION_VERSION,
1247-
"extractCustomTags": custom_tags,
1248-
"customMeasurements": {"limit": CUSTOM_MEASUREMENT_LIMIT},
1249-
"acceptTransactionNames": "clientBased",
1250-
}

tests/sentry/relay/snapshots/test_config/test_project_config_with_breakdown/MONOLITH/with_metrics.pysnap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -915,9 +915,3 @@ metricConditionalTagging:
915915
- d:transactions/measurements.fcp@millisecond
916916
- d:transactions/measurements.lcp@millisecond
917917
targetTag: histogram_outlier
918-
transactionMetrics:
919-
acceptTransactionNames: clientBased
920-
customMeasurements:
921-
limit: 10
922-
extractCustomTags: []
923-
version: 3

tests/sentry/relay/snapshots/test_config/test_project_config_with_breakdown/MONOLITH/without_metrics.pysnap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ breakdownsV2:
1313
- ui
1414
type: spanOperations
1515
metricConditionalTagging: null
16-
transactionMetrics: null

tests/sentry/relay/snapshots/test_config/test_project_config_with_breakdown/REGION/with_metrics.pysnap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,3 @@ metricConditionalTagging:
4646
- d:transactions/measurements.lcp@millisecond
4747
- s:transactions/user@none
4848
targetTag: satisfaction
49-
transactionMetrics:
50-
acceptTransactionNames: clientBased
51-
customMeasurements:
52-
limit: 10
53-
extractCustomTags: []
54-
version: 6

tests/sentry/relay/snapshots/test_config/test_project_config_with_breakdown/REGION/without_metrics.pysnap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ breakdownsV2:
1313
- ui
1414
type: spanOperations
1515
metricConditionalTagging: null
16-
transactionMetrics: null

tests/sentry/relay/test_config.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,6 @@ def test_get_experimental_config_dyn_sampling(mock_logger, _, default_project) -
151151
assert mock_logger.exception.call_args == mock.call(ANY)
152152

153153

154-
@django_db_all
155-
@cell_silo_test
156-
@mock.patch("sentry.relay.config.capture_exception")
157-
def test_get_experimental_config_transaction_metrics_exception(
158-
mock_capture_exception, default_project
159-
):
160-
keys = ProjectKey.objects.filter(project=default_project)
161-
default_project.update_option("sentry:breakdowns", {"invalid_breakdowns": "test"})
162-
# wrong type
163-
default_project.update_option("sentry:transaction_metrics_custom_tags", 42)
164-
165-
with Feature({"organizations:transaction-metrics-extraction": True}):
166-
cfg = get_project_config(default_project, project_keys=keys)
167-
168-
config = cfg.to_dict()["config"]
169-
170-
assert config["transactionMetrics"]["extractCustomTags"] == []
171-
assert mock_capture_exception.call_count == 2
172-
173-
174154
@django_db_all
175155
@cell_silo_test
176156
@pytest.mark.parametrize("has_custom_filters", [False, True])
@@ -538,7 +518,6 @@ def test_project_config_with_breakdown(
538518
insta_snapshot(
539519
{
540520
"breakdownsV2": cfg["config"]["breakdownsV2"],
541-
"transactionMetrics": cfg["config"].get("transactionMetrics"),
542521
"metricConditionalTagging": cfg["config"].get("metricConditionalTagging"),
543522
}
544523
)
@@ -605,52 +584,6 @@ def test_project_config_satisfaction_thresholds(
605584
insta_snapshot(cfg["config"]["metricConditionalTagging"])
606585

607586

608-
@django_db_all
609-
@cell_silo_test
610-
@pytest.mark.parametrize("feature_flag", (False, True), ids=("feature_disabled", "feature_enabled"))
611-
@pytest.mark.parametrize(
612-
"killswitch", (False, True), ids=("killswitch_disabled", "killswitch_enabled")
613-
)
614-
def test_has_metric_extraction(default_project, feature_flag, killswitch) -> None:
615-
options = override_options(
616-
{
617-
"relay.drop-transaction-metrics": (
618-
[{"project_id": default_project.id}] if killswitch else []
619-
)
620-
}
621-
)
622-
feature = Feature(
623-
{
624-
"organizations:transaction-metrics-extraction": feature_flag,
625-
}
626-
)
627-
with feature, options:
628-
project_config = get_project_config(default_project)
629-
config = project_config.to_dict()["config"]
630-
_validate_project_config(config)
631-
if killswitch or not feature_flag:
632-
assert "transactionMetrics" not in config
633-
else:
634-
config = config["transactionMetrics"]
635-
assert config["customMeasurements"]["limit"] > 0
636-
637-
638-
@django_db_all
639-
def test_accept_transaction_names(default_project) -> None:
640-
feature = Feature(
641-
{
642-
"organizations:transaction-metrics-extraction": True,
643-
}
644-
)
645-
with feature:
646-
config = get_project_config(default_project).to_dict()["config"]
647-
648-
_validate_project_config(config)
649-
transaction_metrics_config = config["transactionMetrics"]
650-
651-
assert transaction_metrics_config["acceptTransactionNames"] == "clientBased"
652-
653-
654587
@pytest.mark.parametrize("num_clusterer_runs", [9, 10])
655588
@django_db_all
656589
def test_txnames_ready(default_project, num_clusterer_runs) -> None:

0 commit comments

Comments
 (0)