Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(relay): Remove transaction metrics allowlist and bump relay version #48428

Merged
merged 20 commits into from
May 10, 2023
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
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rfc3986-validator>=0.1.1
sentry-arroyo>=2.10.3
sentry-kafka-schemas>=0.1.6
sentry-redis-tools>=0.1.5
sentry-relay>=0.8.21
sentry-relay>=0.8.22
sentry-sdk>=1.22.2
snuba-sdk>=1.0.5
simplejson>=3.17.6
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ sentry-arroyo==2.10.3
sentry-cli==2.16.0
sentry-kafka-schemas==0.1.6
sentry-redis-tools==0.1.5
sentry-relay==0.8.21
sentry-relay==0.8.22
sentry-sdk==1.22.2
simplejson==3.17.6
six==1.16.0
Expand Down
2 changes: 1 addition & 1 deletion requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ selenium==4.3.0
sentry-arroyo==2.10.3
sentry-kafka-schemas==0.1.6
sentry-redis-tools==0.1.5
sentry-relay==0.8.21
sentry-relay==0.8.22
sentry-sdk==1.22.2
simplejson==3.17.6
six==1.16.0
Expand Down
47 changes: 0 additions & 47 deletions src/sentry/relay/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,42 +523,6 @@ def _filter_option_to_config_setting(flt: _FilterSpec, setting: str) -> Mapping[
TRANSACTION_METRICS_EXTRACTION_VERSION = 1


#: Top-level metrics for transactions
TRANSACTION_METRICS = frozenset(
[
"s:transactions/user@none",
"d:transactions/duration@millisecond",
]
)


ALL_MEASUREMENT_METRICS = frozenset(
[
"d:transactions/measurements.fcp@millisecond",
"d:transactions/measurements.lcp@millisecond",
"d:transactions/measurements.app_start_cold@millisecond",
"d:transactions/measurements.app_start_warm@millisecond",
"d:transactions/measurements.cls@none",
"d:transactions/measurements.fid@millisecond",
"d:transactions/measurements.inp@millisecond",
"d:transactions/measurements.fp@millisecond",
"d:transactions/measurements.frames_frozen@none",
"d:transactions/measurements.frames_frozen_rate@ratio",
"d:transactions/measurements.frames_slow@none",
"d:transactions/measurements.frames_slow_rate@ratio",
"d:transactions/measurements.frames_total@none",
"d:transactions/measurements.time_to_initial_display@millisecond",
"d:transactions/measurements.time_to_full_display@millisecond",
"d:transactions/measurements.stall_count@none",
"d:transactions/measurements.stall_longest_time@millisecond",
"d:transactions/measurements.stall_percentage@ratio",
"d:transactions/measurements.stall_total_time@millisecond",
"d:transactions/measurements.ttfb@millisecond",
"d:transactions/measurements.ttfb.requesttime@millisecond",
]
)


class CustomMeasurementSettings(TypedDict):
limit: int

Expand All @@ -568,7 +532,6 @@ class CustomMeasurementSettings(TypedDict):

class TransactionMetricsSettings(TypedDict):
version: int
extractMetrics: List[str]
extractCustomTags: List[str]
customMeasurements: CustomMeasurementSettings
acceptTransactionNames: TransactionNameStrategy
Expand All @@ -588,15 +551,8 @@ def get_transaction_metrics_settings(
"""This function assumes that the corresponding feature flag has been checked.
See _should_extract_transaction_metrics.
"""
metrics: List[str] = []
custom_tags: List[str] = []

metrics.extend(sorted(TRANSACTION_METRICS))
# TODO: for now let's extract all known measurements. we might want to
# be more fine-grained in the future once we know which measurements we
# really need (or how that can be dynamically determined)
metrics.extend(sorted(ALL_MEASUREMENT_METRICS))

if breakdowns_config is not None:
# we already have a breakdown configuration that tells relay which
# breakdowns to compute for an event. metrics extraction should
Expand All @@ -606,8 +562,6 @@ def get_transaction_metrics_settings(
for _, breakdown_config in breakdowns_config.items():
assert breakdown_config["type"] == "spanOperations"

for op_name in breakdown_config["matches"]:
metrics.append(f"d:transactions/breakdowns.span_ops.ops.{op_name}@millisecond")
except Exception:
capture_exception()

Expand All @@ -622,7 +576,6 @@ def get_transaction_metrics_settings(

return {
"version": TRANSACTION_METRICS_EXTRACTION_VERSION,
"extractMetrics": metrics,
"extractCustomTags": custom_tags,
"customMeasurements": {"limit": CUSTOM_MEASUREMENT_LIMIT},
"acceptTransactionNames": "clientBased",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,33 +918,4 @@ transactionMetrics:
customMeasurements:
limit: 10
extractCustomTags: []
extractMetrics:
- d:transactions/breakdowns.span_ops.ops.browser@millisecond
- d:transactions/breakdowns.span_ops.ops.db@millisecond
- d:transactions/breakdowns.span_ops.ops.http@millisecond
- d:transactions/breakdowns.span_ops.ops.resource@millisecond
- d:transactions/breakdowns.span_ops.ops.ui@millisecond
- d:transactions/duration@millisecond
- d:transactions/measurements.app_start_cold@millisecond
- d:transactions/measurements.app_start_warm@millisecond
- d:transactions/measurements.cls@none
- d:transactions/measurements.fcp@millisecond
- d:transactions/measurements.fid@millisecond
- d:transactions/measurements.fp@millisecond
- d:transactions/measurements.frames_frozen@none
- d:transactions/measurements.frames_frozen_rate@ratio
- d:transactions/measurements.frames_slow@none
- d:transactions/measurements.frames_slow_rate@ratio
- d:transactions/measurements.frames_total@none
- d:transactions/measurements.inp@millisecond
- d:transactions/measurements.lcp@millisecond
- d:transactions/measurements.stall_count@none
- d:transactions/measurements.stall_longest_time@millisecond
- d:transactions/measurements.stall_percentage@ratio
- d:transactions/measurements.stall_total_time@millisecond
- d:transactions/measurements.time_to_full_display@millisecond
- d:transactions/measurements.time_to_initial_display@millisecond
- d:transactions/measurements.ttfb.requesttime@millisecond
- d:transactions/measurements.ttfb@millisecond
- s:transactions/user@none
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -918,33 +918,4 @@ transactionMetrics:
customMeasurements:
limit: 10
extractCustomTags: []
extractMetrics:
- d:transactions/breakdowns.span_ops.ops.browser@millisecond
- d:transactions/breakdowns.span_ops.ops.db@millisecond
- d:transactions/breakdowns.span_ops.ops.http@millisecond
- d:transactions/breakdowns.span_ops.ops.resource@millisecond
- d:transactions/breakdowns.span_ops.ops.ui@millisecond
- d:transactions/duration@millisecond
- d:transactions/measurements.app_start_cold@millisecond
- d:transactions/measurements.app_start_warm@millisecond
- d:transactions/measurements.cls@none
- d:transactions/measurements.fcp@millisecond
- d:transactions/measurements.fid@millisecond
- d:transactions/measurements.fp@millisecond
- d:transactions/measurements.frames_frozen@none
- d:transactions/measurements.frames_frozen_rate@ratio
- d:transactions/measurements.frames_slow@none
- d:transactions/measurements.frames_slow_rate@ratio
- d:transactions/measurements.frames_total@none
- d:transactions/measurements.inp@millisecond
- d:transactions/measurements.lcp@millisecond
- d:transactions/measurements.stall_count@none
- d:transactions/measurements.stall_longest_time@millisecond
- d:transactions/measurements.stall_percentage@ratio
- d:transactions/measurements.stall_total_time@millisecond
- d:transactions/measurements.time_to_full_display@millisecond
- d:transactions/measurements.time_to_initial_display@millisecond
- d:transactions/measurements.ttfb.requesttime@millisecond
- d:transactions/measurements.ttfb@millisecond
- s:transactions/user@none
version: 1
4 changes: 0 additions & 4 deletions tests/sentry/relay/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@

def _validate_project_config(config):
# Relay keeps BTreeSets for these, so sort here as well:
config.get("transactionMetrics", {}).get("extractMetrics", []).sort()
for rule in config.get("metricConditionalTagging", []):
rule["targetMetrics"] = sorted(rule["targetMetrics"])

Expand Down Expand Up @@ -159,8 +158,6 @@ def test_get_experimental_config_transaction_metrics_exception(

config = cfg.to_dict()["config"]

# we check that due to exception we don't add `d:transactions/breakdowns.span_ops.ops.{op_name}@millisecond`
assert "breakdowns.span_ops.ops" not in config["transactionMetrics"]["extractMetrics"]
assert config["transactionMetrics"]["extractCustomTags"] == []
assert mock_capture_exception.call_count == 2

Expand Down Expand Up @@ -535,7 +532,6 @@ def test_has_metric_extraction(default_project, feature_flag, killswitch):
assert "transactionMetrics" not in config
else:
config = config["transactionMetrics"]
assert config["extractMetrics"]
assert config["customMeasurements"]["limit"] > 0


Expand Down