Add hide_args=True to @profiler.trace() where it may cause problems

* Without hide_args=True parameter @profiler.trace() works much
  slower because it gets string representation of decorated method
  parameters internally. Adding it slightly improves performance.

Change-Id: I75a8fecd2e37b1d25c6f70501711e709c2d2ae25
This commit is contained in:
Renat Akhmerov 2017-05-12 15:22:46 +07:00
parent 2a2c8e733b
commit 2c6737b74c
4 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ from mistral.workflow import states
class DefaultEngine(base.Engine):
@action_queue.process
@profiler.trace('engine-start-workflow')
@profiler.trace('engine-start-workflow', hide_args=True)
def start_workflow(self, wf_identifier, wf_input, description='',
**params):
with db_api.transaction():

View File

@ -79,7 +79,7 @@ def _rearrange_commands(cmds):
return res
@profiler.trace('dispatcher-dispatch-commands')
@profiler.trace('dispatcher-dispatch-commands', hide_args=True)
def dispatch_workflow_commands(wf_ex, wf_cmds):
# TODO(rakhmerov): I don't like these imports but otherwise we have
# import cycles.

View File

@ -32,7 +32,7 @@ _CHECK_AND_COMPLETE_PATH = (
)
@profiler.trace('workflow-handler-start-workflow')
@profiler.trace('workflow-handler-start-workflow', hide_args=True)
def start_workflow(wf_identifier, wf_input, desc, params):
wf = workflows.Workflow()
@ -77,7 +77,7 @@ def cancel_workflow(wf_ex, msg=None):
stop_workflow(wf_ex, states.CANCELLED, msg)
@profiler.trace('workflow-handler-check-and-complete')
@profiler.trace('workflow-handler-check-and-complete', hide_args=True)
def _check_and_complete(wf_ex_id):
# Note: This method can only be called via scheduler.
with db_api.transaction():
@ -146,7 +146,7 @@ def resume_workflow(wf_ex, env=None):
wf.resume(env=env)
@profiler.trace('workflow-handler-set-state')
@profiler.trace('workflow-handler-set-state', hide_args=True)
def set_workflow_state(wf_ex, state, msg=None):
if states.is_completed(state):
stop_workflow(wf_ex, state, msg)
@ -163,7 +163,7 @@ def _get_completion_check_key(wf_ex):
return 'wfh_on_c_a_c-%s' % wf_ex.id
@profiler.trace('workflow-handler-schedule-check-and-complete')
@profiler.trace('workflow-handler-schedule-check-and-complete', hide_args=True)
def _schedule_check_and_complete(wf_ex, delay=0):
"""Schedules workflow completion check.

View File

@ -32,7 +32,7 @@ from mistral.workflow import states
LOG = logging.getLogger(__name__)
@profiler.trace('wf-controller-get-controller')
@profiler.trace('wf-controller-get-controller', hide_args=True)
def get_controller(wf_ex, wf_spec=None):
"""Gets a workflow controller instance by given workflow execution object.
@ -85,7 +85,7 @@ class WorkflowController(object):
self.wf_spec = wf_spec
@profiler.trace('workflow-controller-continue-workflow')
@profiler.trace('workflow-controller-continue-workflow', hide_args=True)
def continue_workflow(self, task_ex=None):
"""Calculates a list of commands to continue the workflow.