Skip to content

Count uncompressed body length from final HTTP response only - #1636

Open
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix/896-uncompressed-body-redirect
Open

Count uncompressed body length from final HTTP response only#1636
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix/896-uncompressed-body-redirect

Conversation

@locker95

Copy link
Copy Markdown

Description

probe_http_uncompressed_body_length should reflect only the final response body after redirects. Intermediate 3xx payloads must not contribute.

The prober already reads resp.Body from the response returned by http.Client (the last hop). This change:

  1. Clarifies the metric HELP text
  2. Adds an httptest regression test with distinct redirect vs final body sizes (including a two-hop chain)

Fixes #896

How to verify

go test ./prober/ -run TestUncompressedBodyLengthOnlyFinalResponse -count=1 -v
[BUGFIX] Document and test that probe_http_uncompressed_body_length counts only the final response body after redirects #896

Document and regression-test that the metric reflects only the final HTTP
response body after redirects. Intermediate redirect payloads are
discarded by net/http and must not affect the gauge.

Clarify the metric HELP text accordingly.

Fixes prometheus#896

Signed-off-by: Dean Chen <862469039@qq.com>
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.

probe_http_uncompressed_body_length is wrong in case of redirect

1 participant