Add more tracing to kojiwrapper

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2025-03-20 13:42:45 +01:00
parent 69d87c27ff
commit 431cd630e9

View file

@ -287,6 +287,7 @@ class KojiWrapper(object):
:return dict: {"retcode": 0, "output": "", "task_id": 1} :return dict: {"retcode": 0, "output": "", "task_id": 1}
""" """
task_id = None task_id = None
with tracing.span("run-runroot-cmd", command=command):
with self.get_koji_cmd_env() as env: with self.get_koji_cmd_env() as env:
retcode, output = run( retcode, output = run(
command, command,
@ -315,6 +316,7 @@ class KojiWrapper(object):
) )
self.save_task_id(task_id) self.save_task_id(task_id)
tracing.set_attribute("task_id", task_id)
retcode, output = self._wait_for_task(task_id, logfile=log_file) retcode, output = self._wait_for_task(task_id, logfile=log_file)
@ -431,6 +433,7 @@ class KojiWrapper(object):
attempt = 0 attempt = 0
while True: while True:
with tracing.span("watch-task", task_id=task_id):
retcode, output = run( retcode, output = run(
cmd, can_fail=True, logfile=logfile, text=True, errors="replace" cmd, can_fail=True, logfile=logfile, text=True, errors="replace"
) )
@ -457,6 +460,7 @@ class KojiWrapper(object):
its exit code and parsed task id. This method will block until the its exit code and parsed task id. This method will block until the
command finishes. command finishes.
""" """
with tracing.span("run-blocking-cmd", command=command):
with self.get_koji_cmd_env() as env: with self.get_koji_cmd_env() as env:
retcode, output = run( retcode, output = run(
command, command,
@ -476,6 +480,7 @@ class KojiWrapper(object):
% (" ".join(command), output) % (" ".join(command), output)
) )
task_id = int(match.groups()[0]) task_id = int(match.groups()[0])
tracing.set_attribute("task_id", task_id)
self.save_task_id(task_id) self.save_task_id(task_id)