Skip to content

Commit 2ccae38

Browse files
authored
feat(derive_code_mappings): Enable JS code derivation for EA orgs (#42147)
This stops running JS events in dry run mode and will start creating code mappings. Fixes WOR-2410
1 parent e3b79e9 commit 2ccae38

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/sentry/tasks/derive_code_mappings.py

+10-15
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,17 @@ def derive_code_mappings(
6565
return
6666

6767
trees = {}
68-
if not dry_run:
69-
trees = installation.get_trees_for_org()
70-
else:
71-
# Acquire the lock for a maximum of 10 minutes
72-
lock = locks.get(
73-
key=f"get_trees_for_org:{org.slug}", duration=60 * 10, name="process_pending"
74-
)
68+
# Acquire the lock for a maximum of 10 minutes
69+
lock = locks.get(key=f"get_trees_for_org:{org.slug}", duration=60 * 10, name="process_pending")
7570

76-
try:
77-
with lock.acquire():
78-
trees = installation.get_trees_for_org(3600 * 3)
79-
except UnableToAcquireLock as error:
80-
extra["error"] = error
81-
logger.warning("derive_code_mappings.getting_lock_failed", extra=extra)
82-
# This will cause the auto-retry logic to try again
83-
raise error
71+
try:
72+
with lock.acquire():
73+
trees = installation.get_trees_for_org(3600 * 3)
74+
except UnableToAcquireLock as error:
75+
extra["error"] = error
76+
logger.warning("derive_code_mappings.getting_lock_failed", extra=extra)
77+
# This will cause the auto-retry logic to try again
78+
raise error
8479

8580
trees_helper = CodeMappingTreesHelper(trees)
8681
code_mappings = trees_helper.generate_code_mappings(stacktrace_paths)

src/sentry/tasks/post_process.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -623,17 +623,13 @@ def process_code_mappings(job: PostProcessJob) -> None:
623623
if project_queued:
624624
return
625625

626-
org_slug = project.organization.slug
626+
org = event.project.organization
627+
org_slug = org.slug
627628
next_time = timezone.now() + timedelta(hours=1)
628-
has_normal_run_flag = features.has(
629-
"organizations:derive-code-mappings", event.project.organization
630-
)
631-
has_dry_run_flag = features.has(
632-
"organizations:derive-code-mappings-dry-run", event.project.organization
633-
)
629+
has_normal_run_flag = features.has("organizations:derive-code-mappings", org)
630+
has_dry_run_flag = features.has("organizations:derive-code-mappings-dry-run", org)
634631

635-
# Right now EA orgs have both flags on, thus, only supporting dry run
636-
if has_normal_run_flag and event.data["platform"] == "python":
632+
if has_normal_run_flag:
637633
logger.info(
638634
f"derive_code_mappings: Queuing code mapping derivation for {project.slug=} {event.group_id=}."
639635
+ f" Future events in {org_slug=} will not have not have code mapping derivation until {next_time}"

0 commit comments

Comments
 (0)