Skip to content

Profile and time deploy operations #1717

@wowi42

Description

@wowi42

Summary

Provide built-in profiling and timing for pyinfra deploys so users can see how long each operation takes and identify bottlenecks.

Motivation

Wrapping the whole run with time gives a single overall number, which is not enough to understand where time is spent. Per-operation timing would help users:

  • Compare deploy speed across instance types and connectors.
  • Identify slow operations or facts.
  • Diagnose regressions after upgrades.

Proposed scope

  • Time both phases of every operation: prepare/generate and execute.
  • Time fact gathering per host and per fact.
  • Print a final summary at the end of the run, similar to Finished, took 11 min 35 s, plus a breakdown of the slowest operations and facts.
  • Optionally include timestamps on each -vvv log line so users can correlate timings with individual commands.
  • Expose timing data programmatically via the API or as a structured output (JSON) so it can be consumed by external tooling.

References

Consolidates and supersedes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    specSpecification discussion / early stage issues.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions