Skip to content

docs: clarify bounded body-logging size semantics and ordered-stage rationale - #86

Merged
OmarAlJarrah merged 2 commits into
mainfrom
docs/http-logging-and-pipeline-notes
Jun 16, 2026
Merged

OmarAlJarrah merged 2 commits into
mainfrom
docs/http-logging-and-pipeline-notes

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

Fills two documentation gaps in the HTTP stack.

Bounded body-logging size semantics

Under BODY_AND_HEADERS, the response body delivered to the consumer can be larger than the single-read logging preview. The preview is bounded by bodyPreviewMaxBytes (default 8 KiB) and the logged body-size field reflects the captured/preview size, while the full body still streams downstream to the consumer (its true length is available from the content-length field, and unknown-length streaming bodies are skipped for capture entirely). This was easy to misread as "logging truncates the body" or "the size field is the full size." Documented in docs/http-body-logging-and-concurrency.md and in the relevant HttpInstrumentationOptions / HttpLogLevel KDoc.

Why ordered stages instead of nested decorators

Documents the rationale for the http.pipeline design — a flat, ordered list of stages (Stage with fixed pillar ordering) rather than nested client decorators: deterministic and inspectable ordering, a single place to reason about stage precedence, enforced pillar-uniqueness, and shared sync/async ordering — along with the cost it carries (the next.copy() re-drive contract). Added to docs/pipelines.md with a cross-reference from docs/architecture.md.

Documentation only — no code or API change (KDoc additions on existing declarations).

Closes #18
Closes #77

…ionale

Two documentation gaps around HTTP instrumentation:

Under BODY_AND_HEADERS logging, the response body capture is bounded to
bodyPreviewMaxBytes, but the full body still flows to the consumer — a body
larger than the cap is streamed in full while only a preview prefix is buffered.
The logged response.body.size / response.body.preview fields therefore describe
the captured preview, not necessarily the whole body, whereas response.content.length
reports the body's true length. Document this in
http-body-logging-and-concurrency.md and add a concise note to the
HttpLogLevel.BODY_AND_HEADERS and HttpInstrumentationOptions KDoc so it is visible
at the opt-in point, not just on LoggableResponseBody.

Also explain why the stage-based http.pipeline layer uses an ordered Stage enum
with single-step pillar stages (REDIRECT/RETRY/AUTH/LOGGING/SERDE) instead of
nested HttpClient decorators: deterministic and inspectable run order, one place
to reason about stage precedence, enforced pillar-uniqueness, and shared ordering
across the sync and async runtimes — plus the one cost it buys, the
PipelineNext.copy() re-drive contract that wrapping steps must honour. Added to
pipelines.md with a cross-reference from architecture.md.
Clarify that the ordered-stage rationale lists five cross-cutting pillar
stages (SERDE currently reserved/unused) and that SEND is also a singleton
slot but represents the transport hop, not a configurable pillar — matching
the six isPillar entries in the Stage enum.
@OmarAlJarrah
OmarAlJarrah merged commit c4a9599 into main Jun 16, 2026
1 check passed
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.

Document why the HTTP pipeline uses ordered stages rather than nested client decorators Document that BODY_AND_HEADERS makes response bodies larger than the preview single-read

1 participant