Skip to content

Commit 760c130

Browse files
committed
cleanup
1 parent b6f083d commit 760c130

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/sentry/tasks/statistical_detectors.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,23 @@ def detect_function_trends(project_ids: List[int], start: datetime, *args, **kwa
160160
def detect_function_change_points(
161161
functions_list: List[Tuple[int, int]], start: datetime, *args, **kwargs
162162
) -> None:
163-
_detect_function_change_points(functions_list, start)
163+
breakpoints = _detect_function_change_points(functions_list, start)
164+
165+
for entry in breakpoints:
166+
with sentry_sdk.push_scope() as scope:
167+
scope.set_tag("regressed_project_id", entry["project"])
168+
# the service was originally meant for transactions so this
169+
# naming is a result of this
170+
scope.set_tag("regressed_function_id", entry["transaction"])
171+
scope.set_context(
172+
"statistical_detectors",
173+
{
174+
**entry,
175+
"timestamp": start.isoformat(),
176+
"breakpoint": datetime.fromtimestamp(entry["breakpoint"]),
177+
},
178+
)
179+
sentry_sdk.capture_message("Potential Regression")
164180

165181

166182
def _detect_function_trends(
@@ -259,21 +275,7 @@ def _detect_function_change_points(functions_list: List[Tuple[int, int]], start:
259275

260276
breakpoints = detect_breakpoints(request)["data"]
261277

262-
for entry in breakpoints:
263-
with sentry_sdk.push_scope() as scope:
264-
scope.set_tag("regressed_project_id", entry["project"])
265-
# the service was originally meant for transactions so this
266-
# naming is a result of this
267-
scope.set_tag("regressed_function_id", entry["transaction"])
268-
scope.set_context(
269-
"statistical_detectors",
270-
{
271-
**entry,
272-
"timestamp": start.isoformat(),
273-
"breakpoint": datetime.fromtimestamp(entry["breakpoint"]),
274-
},
275-
)
276-
sentry_sdk.capture_message("Potential Regression")
278+
yield from breakpoints
277279

278280

279281
def all_function_payloads(

0 commit comments

Comments
 (0)