Headers propagation from an execution request to actions/notifications

Currently Mistal doesn`t support distribution tracing, which means
that there`s no way to propagate traceId/spanId from an execution to
related actions/notifications.
It leads us to an issue, because according to distribution tracing
principles "traceId" should remain the same during the discovery
process, which includes Mistral worflow execution.
Proposed solution is to keep some headers from execution request
and propagate them later to actions/notifications.
Regexp can be stored as env variable to define headers which
will be propagated.

Implements blueprint add-headers-propagation

Change-Id: Id8cc900a7d94286e79f1ece4dc4177383263f55c
This commit is contained in:
Vadim Zelenevsky 2023-11-07 14:27:58 +06:00 committed by Oleg Ovcharuk
parent 5d7fd30ba3
commit 737e09646f

View File

@ -70,7 +70,8 @@ class ExecutionContext(object):
def __init__(self, workflow_execution_id=None, task_execution_id=None, def __init__(self, workflow_execution_id=None, task_execution_id=None,
action_execution_id=None, workflow_name=None, action_execution_id=None, workflow_name=None,
callback_url=None, task_id=None, with_items_index=0, callback_url=None, task_id=None, with_items_index=0,
task_rerun_no=0, task_rerun_id=None): task_rerun_no=0, task_rerun_id=None,
workflow_propagated_headers=None):
self.workflow_execution_id = workflow_execution_id self.workflow_execution_id = workflow_execution_id
self.task_execution_id = task_execution_id self.task_execution_id = task_execution_id
self.action_execution_id = action_execution_id self.action_execution_id = action_execution_id
@ -79,10 +80,10 @@ class ExecutionContext(object):
self.with_items_index = with_items_index self.with_items_index = with_items_index
self.task_rerun_no = task_rerun_no self.task_rerun_no = task_rerun_no
self.task_rerun_id = task_rerun_id self.task_rerun_id = task_rerun_id
self.workflow_propagated_headers = workflow_propagated_headers
if task_id is not None: if task_id is not None:
self.task_execution_id = task_id self.task_execution_id = task_id
self._deprecate_task_id_warning() self._deprecate_task_id_warning()
def _deprecate_task_id_warning(self): def _deprecate_task_id_warning(self):