Skip to content

Fix inflated response times by removing millisecond-to-microsecond conversion #1454

@leandrowilliam

Description

@leandrowilliam

In src/registry/middleware/request-handler.ts, we are currently multiplying the response time by 1000:

duration: Number.parseInt(String(time * 1000), 10),

This incorrectly converts milliseconds to microseconds, resulting in inflated response time values.

The response-time library already provides time in milliseconds (e.g., 0.9457 or 20.5857), as documented. Multiplying by 1000 and parsing as an integer is unnecessary and may reduce precision for fast requests.

Suggested solution:

Keep the time value as-is in milliseconds:

duration: time,

This will ensure accurate reporting of response times, including fractional milliseconds, and align with standard web performance monitoring practices.

Additional context:

  • Using parseInt would truncate sub-millisecond precision.
  • Standard monitoring tools typically expect milliseconds, so no conversion is needed.

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions