diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/tasks_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/tasks_controller.py index fcc0dba0..feb9218e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/tasks_controller.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/tasks_controller.py @@ -380,15 +380,16 @@ def task_submit_shared( ) ) - processor.lock_process_instance("Web") - ProcessInstanceService.complete_form_task( - processor=processor, - spiff_task=spiff_task, - data=body, - user=g.user, - human_task=human_task, - ) - processor.unlock_process_instance("Web") + with sentry_sdk.start_span(op="task", description="complete_form_task"): + processor.lock_process_instance("Web") + ProcessInstanceService.complete_form_task( + processor=processor, + spiff_task=spiff_task, + data=body, + user=g.user, + human_task=human_task, + ) + processor.unlock_process_instance("Web") # If we need to update all tasks, then get the next ready task and if it a multi-instance with the same # task spec, complete that form as well. @@ -428,15 +429,13 @@ def task_submit( sentry_transaction_name = "tasks_controller.task_submit" transaction = sentry_sdk.Hub.current.scope.transaction if transaction is None: - current_app.logger.debug( - "transaction was None. pretty sure this never happens." - ) + current_app.logger.info("transaction was None. pretty sure this never happens.") with sentry_sdk.start_transaction(op=sentry_op, name=sentry_transaction_name): return task_submit_shared( process_instance_id, task_id, body, terminate_loop ) else: - current_app.logger.debug("transaction existed.") + current_app.logger.info("transaction existed.") with transaction.start_child(op=sentry_op, description=sentry_transaction_name): return task_submit_shared( process_instance_id, task_id, body, terminate_loop diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py index 9b07ce1f..63c53a21 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -4,6 +4,7 @@ from typing import Any from typing import List from typing import Optional +import sentry_sdk from flask import current_app from SpiffWorkflow.task import Task as SpiffTask # type: ignore @@ -234,8 +235,9 @@ class ProcessInstanceService: # ProcessInstanceService.post_process_form(spiff_task) # some properties may update the data store. processor.complete_task(spiff_task, human_task, user=user) - # maybe move this out once we have the interstitial page since this is here just so we can get the next human task - processor.do_engine_steps(save=True) + with sentry_sdk.start_span(op="task", description="backend_do_engine_steps"): + # maybe move this out once we have the interstitial page since this is here just so we can get the next human task + processor.do_engine_steps(save=True) @staticmethod def extract_form_data(latest_data: dict, task: SpiffTask) -> dict: