|
@@ -1,7 +1,7 @@
|
|
|
import logging
|
|
|
import uuid
|
|
|
from datetime import datetime
|
|
|
-from typing import Any, Collection, Mapping, Optional, Sequence, TypedDict
|
|
|
+from typing import Any, Collection, Literal, Mapping, Optional, Sequence, TypedDict
|
|
|
|
|
|
import sentry_sdk
|
|
|
from pytz import utc
|
|
@@ -432,11 +432,15 @@ class CustomMeasurementSettings(TypedDict):
|
|
|
limit: int
|
|
|
|
|
|
|
|
|
+TransactionNameStrategy = Literal["strict", "clientBased"]
|
|
|
+
|
|
|
+
|
|
|
class TransactionMetricsSettings(TypedDict):
|
|
|
version: int
|
|
|
extractMetrics: Collection[str]
|
|
|
extractCustomTags: Collection[str]
|
|
|
customMeasurements: CustomMeasurementSettings
|
|
|
+ acceptTransactionNames: TransactionNameStrategy
|
|
|
|
|
|
|
|
|
def _should_extract_transaction_metrics(project: Project) -> bool:
|
|
@@ -448,6 +452,11 @@ def _should_extract_transaction_metrics(project: Project) -> bool:
|
|
|
)
|
|
|
|
|
|
|
|
|
+def _accept_transaction_names_strategy(project: Project) -> TransactionNameStrategy:
|
|
|
+ is_selected_org = sample_modulo("relay.transaction-names-client-based", project.organization_id)
|
|
|
+ return "clientBased" if is_selected_org else "strict"
|
|
|
+
|
|
|
+
|
|
|
def get_transaction_metrics_settings(
|
|
|
project: Project, breakdowns_config: Optional[Mapping[str, Any]]
|
|
|
) -> TransactionMetricsSettings:
|
|
@@ -492,4 +501,5 @@ def get_transaction_metrics_settings(
|
|
|
"extractMetrics": metrics,
|
|
|
"extractCustomTags": custom_tags,
|
|
|
"customMeasurements": {"limit": CUSTOM_MEASUREMENT_LIMIT},
|
|
|
+ "acceptTransactionNames": _accept_transaction_names_strategy(project),
|
|
|
}
|