Skip to content

Enrich test reports with detailed latency and network performance metrics #972

Description

@arcursino

Feature request

Description the feature

Capture and report detailed network timing metrics for each API request and display them visually in the HTML report.

Goals of this feature:

  • Granular Network Visibility: Capture and expose detailed, low-level network timing metrics (DNS lookup, SSL handshake, TTFB, and content transfer) for every request.
  • Visual Performance Reporting: Update the HTML reporter to display these metrics using intuitive visual components (e.g., a stacked horizontal bar chart).
  • Minimal Performance Overhead: Ensure the network timing collection mechanism introduces negligible latency overhead so it does not skew the actual API test results.

Is your feature request related to a problem?

Yes. ScanAPI is highly effective at functional testing (verifying status codes, JSON schemas, and response bodies). However, API performance is just as critical as correctness. Currently, ScanAPI only tracks the overall elapsed time of a request, but it does not break down where the time was spent. Developers cannot easily tell if a slow request is due to a slow DNS resolution, a slow SSL handshake, or a slow server response.

Do you have any suggestions on how to add this feature in scanapi ?

  • Timing Extraction: Since ScanAPI uses requests (or similar HTTP clients) under the hood, we can hook into lower-level connection timing. For Python's requests, we can leverage the urllib3 connection pool or use libraries like http.client hooks to extract connection-level timings.
  • Metrics to Capture:
    • DNS Lookup Time: Time spent resolving the hostname.
    • TLS/SSL Handshake Time: Time spent establishing a secure connection.
    • Time to First Byte (TTFB): Time elapsed between sending the request and receiving the first byte of the response.
    • Content Transfer Time: Time spent downloading the response payload.
  • UI Update: Update the HTML reporter template to include a small horizontal stacked bar chart showing DNS -> TLS -> TTFB -> Transfer for each request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ReporterRelated with the API doc generated by ScanAPI
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions