Expand the scope of zkprofile

Currently the zkprofile command only profiles the pipeline refresh
operations.  This expands the scope to include all pipeline operations
(refreshing and then any subsequent changes).  In particular, this
will help identify places where we write too much data.

Change-Id: Ida7bcb311b5037f6ce15a166ddeae6db44ed6709
This commit is contained in:
James E. Blair 2023-02-14 16:32:51 -08:00
parent 5922c66dd1
commit 3a829196b9
1 changed files with 3 additions and 4 deletions

View File

@ -2242,6 +2242,9 @@ class Scheduler(threading.Thread):
blocking=False) as lock,\
self.createZKContext(lock, self.log) as ctx:
with pipeline.manager.currentContext(ctx):
if ((tenant.name, pipeline.name) in
self._profile_pipelines):
ctx.profile = True
with self.statsd_timer(f'{stats_key}.handling'):
refreshed = self._process_pipeline(
tenant, pipeline)
@ -2310,14 +2313,10 @@ class Scheduler(threading.Thread):
stats_key = f'zuul.tenant.{tenant.name}.pipeline.{pipeline.name}'
ctx = pipeline.manager.current_context
if (tenant.name, pipeline.name) in self._profile_pipelines:
ctx.profile = True
with self.statsd_timer(f'{stats_key}.refresh'):
pipeline.change_list.refresh(ctx)
pipeline.summary.refresh(ctx)
pipeline.state.refresh(ctx)
if (tenant.name, pipeline.name) in self._profile_pipelines:
ctx.profile = False
pipeline.state.setDirty(self.zk_client.client)
if pipeline.state.old_queues: