Skip to content

Commit ac4b6c6

Browse files
authored
feat(detectors): Add filtered_paths setting for Large HTTP Detector (#100842)
follow up to #100634 - we want to allow users to explicitly state any paths that we should filter out if we see them in spans. gives the user a bit more control beyond any automatic filtering we do. will need a frontend PR to allow users to edit these settings and update the detection algorithm to support this filtering
1 parent dc897aa commit ac4b6c6

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/sentry/features/temporary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def register_temporary_features(manager: FeatureManager) -> None:
173173
manager.add("organizations:metric-issue-poc", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
174174
manager.add("projects:metric-issue-creation", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
175175
# Enable Large HTTP Payload Detector Improvements
176-
manager.add("organizations:large-http-payload-detector-improvements", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
176+
manager.add("organizations:large-http-payload-detector-improvements", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
177177
manager.add("organizations:mep-rollout-flag", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
178178
manager.add("organizations:mep-use-default-tags", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
179179
manager.add("organizations:disable-clustering-setting", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True, default=False)

src/sentry/issue_detection/performance_detection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def get_merged_settings(project_id: int | None = None) -> dict[str | Any, Any]:
176176
"large_http_payload_size_threshold": options.get(
177177
"performance.issues.large_http_payload.size_threshold"
178178
),
179+
"large_http_payload_filtered_paths": options.get(
180+
"performance.issues.large_http_payload.filtered_paths"
181+
),
179182
"db_on_main_thread_duration_threshold": options.get(
180183
"performance.issues.db_on_main_thread.total_spans_duration_threshold"
181184
),
@@ -329,6 +332,7 @@ def get_detection_settings(
329332
"detection_enabled": settings["large_http_payload_detection_enabled"],
330333
"minimum_span_duration": 100, # ms
331334
"organization": organization,
335+
"filtered_paths": settings["large_http_payload_filtered_paths"],
332336
},
333337
DetectorType.HTTP_OVERHEAD: {
334338
"http_request_delay_threshold": settings["http_request_delay_threshold"],

src/sentry/issues/endpoints/project_performance_issue_settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ConfigurableThresholds(Enum):
5757
UNCOMPRESSED_ASSET_SIZE = "uncompressed_asset_size_threshold"
5858
LARGE_HTTP_PAYLOAD = "large_http_payload_detection_enabled"
5959
LARGE_HTTP_PAYLOAD_SIZE = "large_http_payload_size_threshold"
60+
LARGE_HTTP_PAYLOAD_FILTERED_PATHS = "large_http_payload_filtered_paths"
6061
DB_ON_MAIN_THREAD = "db_on_main_thread_detection_enabled"
6162
DB_ON_MAIN_THREAD_DURATION = "db_on_main_thread_duration_threshold"
6263
FILE_IO_MAIN_THREAD = "file_io_on_main_thread_detection_enabled"
@@ -103,6 +104,7 @@ class ConfigurableThresholds(Enum):
103104
ConfigurableThresholds.UNCOMPRESSED_ASSET_DURATION.value: ConfigurableThresholds.UNCOMPRESSED_ASSET.value,
104105
ConfigurableThresholds.UNCOMPRESSED_ASSET_SIZE.value: ConfigurableThresholds.UNCOMPRESSED_ASSET.value,
105106
ConfigurableThresholds.LARGE_HTTP_PAYLOAD_SIZE.value: ConfigurableThresholds.LARGE_HTTP_PAYLOAD.value,
107+
ConfigurableThresholds.LARGE_HTTP_PAYLOAD_FILTERED_PATHS.value: ConfigurableThresholds.LARGE_HTTP_PAYLOAD.value,
106108
ConfigurableThresholds.DB_ON_MAIN_THREAD_DURATION.value: ConfigurableThresholds.DB_ON_MAIN_THREAD.value,
107109
ConfigurableThresholds.FILE_IO_MAIN_THREAD_DURATION.value: ConfigurableThresholds.FILE_IO_MAIN_THREAD.value,
108110
ConfigurableThresholds.CONSECUTIVE_DB_QUERIES_MIN_TIME_SAVED.value: ConfigurableThresholds.CONSECUTIVE_DB_QUERIES.value,
@@ -133,6 +135,11 @@ class ProjectPerformanceIssueSettingsSerializer(serializers.Serializer):
133135
large_http_payload_size_threshold = serializers.IntegerField(
134136
required=False, min_value=100000, max_value=TEN_MB
135137
)
138+
large_http_payload_filtered_paths = serializers.CharField(
139+
required=False,
140+
allow_blank=True,
141+
max_length=1000,
142+
)
136143
db_on_main_thread_duration_threshold = serializers.IntegerField(
137144
required=False, min_value=10, max_value=50
138145
)

src/sentry/options/defaults.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,11 @@
18781878
default=300000,
18791879
flags=FLAG_AUTOMATOR_MODIFIABLE,
18801880
) # 1MB
1881+
register(
1882+
"performance.issues.large_http_payload.filtered_paths",
1883+
default="",
1884+
flags=FLAG_AUTOMATOR_MODIFIABLE,
1885+
)
18811886
register(
18821887
"performance.issues.db_on_main_thread.total_spans_duration_threshold",
18831888
default=16,

0 commit comments

Comments
 (0)