Skip to content

[PoC] Surface per-script execution time on the script trigger result - #1573

Draft
saialekhya-001 wants to merge 1 commit into
developfrom
feat/script-exec-timing-poc
Draft

saialekhya-001 wants to merge 1 commit into
developfrom
feat/script-exec-timing-poc

Conversation

@saialekhya-001

Copy link
Copy Markdown

What / Why

PoC to enable showing a per-request-execution time breakdown in performance runs — the same HTTP phase waterfall the single-request view shows (Prepare / Socket Init / DNS / TCP / SSL / TTFB / Download / Process) plus prerequest/test script execution time. Runtime already emits the HTTP timing offsets; it did not surface how long user scripts take. This adds that.

Change

lib/runner/extensions/event.command.js — around host.execute() in the script execution path:

  • Stamp result.executionTime (ms) on the script result before the script trigger fires.
  • Prefer the sandbox's own in-sandbox measure result.return.executionTime (added in companion [postman-sandbox PoC PR]) — it excludes host↔sandbox bridge/IPC and host-side queue wait, so it's a tighter, steadier number.
  • Fall back to a host wall-clock measure around host.execute() when the sandbox doesn't provide one → safe with an unpatched sandbox.
  • Also attaches result.executionTimeWall for PoC comparison (in-sandbox vs wall). To be removed before productionization.

Measured (2 VUs, local)

in-sandbox host wall-clock bridge+queue gap
rec0 39 ms 63 ms 24 ms
rec1 47 ms 61 ms 14 ms
rec2 53 ms 55 ms 2 ms

In-sandbox is consistently lower and less jittery → the right source.

Companion changes

  • postman-sandbox: adds execution.return.executionTime (in-sandbox duration).
  • postman-performance-test: consumes result.executionTime + the HTTP phase breakdown per execution.

Status

Draft / PoC. Not productionized: wall-clock comparison field is temporary; based on recent develop.

Generated with Claude Code

…sult

Measures how long each prerequest/test script takes and exposes it on the
`script` trigger's `result` so downstream consumers (e.g. performance test
runs) can report script cost alongside the HTTP timing phases.

- Prefers the sandbox's own in-sandbox measure (`result.return.executionTime`,
  added in a companion postman-sandbox change) which excludes host<->sandbox
  bridge/IPC and host-side queue wait.
- Falls back to a host wall-clock measure around `host.execute()` when the
  sandbox does not provide one, so the change is safe with an unpatched sandbox.
- Also attaches `result.executionTimeWall` (the wall-clock value) for PoC
  comparison; to be dropped before productionization.

PoC for visualizing response-time breakdown + script execution time per
request execution in performance runs.

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.71%. Comparing base (6b4c942) to head (def386a).

Files with missing lines Patch % Lines
lib/runner/extensions/event.command.js 71.42% 0 Missing and 2 partials ⚠️

❌ Your project check has failed because the head coverage (34.14%) is below the target coverage (35.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1573      +/-   ##
===========================================
- Coverage    77.72%   77.71%   -0.02%     
===========================================
  Files           51       51              
  Lines         4369     4376       +7     
  Branches      1234     1238       +4     
===========================================
+ Hits          3396     3401       +5     
  Misses         730      730              
- Partials       243      245       +2     
Flag Coverage Δ
integration 68.98% <71.42%> (+<0.01%) ⬆️
legacy 34.14% <57.14%> (+0.03%) ⬆️
unit 47.00% <42.85%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant