It would be useful for performance monitoring, logging and debugging if the HTTP request elapsed time (duration) was included in the ExecutionResult returned by RequestsHTTPTransport. The extensions field for implementation-specific data seems like the place to expose this data.
The underlying requests.Response object has .elapsed, but this is not currently exposed via any public API or returned result.
Proposed Solution
- When constructing the
ExecutionResult in RequestsHTTPTransport, add a key (e.g., "elapsed") to the extensions dictionary, with the value set to response.elapsed.total_seconds().
- This information will then be accessible as
result.extensions["elapsed"] for any consumer of the library, without breaking any existing API.
Alternatives Considered
- Subclassing
RequestsHTTPTransport and overriding execute. This is not practical, as internal APIs are not designed for easy override, and the requests.Response object is not exposed.
Thanks!