Add more tracing to kojiwrapper

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit 431cd630e93d8655329a0a1c77d291e7714c12c4)
This commit is contained in:
Lubomír Sedlář 2025-03-20 13:42:45 +01:00 committed by Stepan Oksanichenko
parent 85d7d19dc5
commit 4d432fd385

View File

@ -288,6 +288,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,
@ -316,6 +317,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)
@ -432,6 +434,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"
) )
@ -458,6 +461,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,
@ -477,6 +481,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)