Skip to content

Conversation

phrwlk
Copy link
Contributor

@phrwlk phrwlk commented Sep 18, 2025

This change fixes downloaders.bodies.response.response_size_bytes in BodiesRequestFuture::try_buffer_blocks to reflect only the sizes of actual bodies received:

  • Initialize total_size to 0 instead of using bodies.capacity() * size_of::<C::Body>().
  • Do not add any size for empty headers.
  • Sum only next_body.size() for non-empty bodies.

Rationale:

  • The metric is documented as the size (in bytes) of an individual bodies response. Including the input Vec capacity reflects local allocation details and double-counts memory since BlockBody::size() already accounts for internal capacities. Adding a pseudo-size for empty headers further inflates the metric while response_length counts only real bodies, skewing dashboards (e.g., average size = size/length).
  • Elsewhere we include capacities only for buffer footprint metrics (e.g., buffer_bodies_response), not for per-response sizing. This change aligns semantics with documentation and Grafana usage, yielding accurate and comparable observability without affecting functional behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

1 participant