|
21 | 21 | from execution_process import run_monitored, subprocess_options |
22 | 22 | from queue_worker_client import QueueWorkerClient, acknowledge_results |
23 | 23 | import state_branch as state_branch_git |
24 | | -from telemetry import child_environment |
| 24 | +from telemetry import child_environment, child_process_span |
25 | 25 | from telemetry import session as telemetry_session |
26 | 26 |
|
27 | 27 | SCRIPT_DIR = Path(__file__).resolve().parent |
@@ -705,19 +705,23 @@ def _run( |
705 | 705 | env: dict[str, str], |
706 | 706 | print_stdout: bool = True, |
707 | 707 | ) -> subprocess.CompletedProcess[str]: |
708 | | - env = child_environment(env) |
709 | | - if self.lease_check is None: |
710 | | - result = self.run( |
711 | | - command, |
712 | | - cwd=self.repository_root, |
713 | | - env=env, |
714 | | - text=True, |
715 | | - encoding="utf-8", |
716 | | - capture_output=True, |
717 | | - **subprocess_options(), |
718 | | - ) |
719 | | - else: |
720 | | - result = run_monitored(command, self.lease_check, cwd=self.repository_root, env=env) |
| 708 | + with child_process_span(command) as record_exit: |
| 709 | + env = child_environment(env) |
| 710 | + if self.lease_check is None: |
| 711 | + result = self.run( |
| 712 | + command, |
| 713 | + cwd=self.repository_root, |
| 714 | + env=env, |
| 715 | + text=True, |
| 716 | + encoding="utf-8", |
| 717 | + capture_output=True, |
| 718 | + **subprocess_options(), |
| 719 | + ) |
| 720 | + else: |
| 721 | + result = run_monitored( |
| 722 | + command, self.lease_check, cwd=self.repository_root, env=env |
| 723 | + ) |
| 724 | + record_exit(result.returncode) |
721 | 725 | if result.stdout and print_stdout: |
722 | 726 | print(result.stdout, end="") |
723 | 727 | if result.stderr: |
@@ -833,5 +837,5 @@ def main() -> int: |
833 | 837 |
|
834 | 838 |
|
835 | 839 | if __name__ == "__main__": |
836 | | - with telemetry_session(): |
| 840 | + with telemetry_session(name="process_queue_batch.py"): |
837 | 841 | sys.exit(main()) |
0 commit comments