Expand description
Accounting and observability for one streamed body, in either direction.
This is the merge of two implementations that had independently converged on the same
design (axum-streams’ progress.rs and reqwest-streams’ observability.rs), and it
takes the union of their behaviour. Both dependents drive it; neither owns a copy.
Unlike an earlier design, the tracing callsites live here rather than in the binding
crates. tracing bakes a span’s name and target into a static Metadata, so they cannot be
passed in at runtime; keeping them here means one target, http_streams_core, with the
direction carried as a span field instead.
Structs§
- Error
Info - What the accounting needs to know about an error passing through a stream.
- Progress
- The accounting handle threaded through one stream’s pipeline.
- Progress
Options - The direction-neutral subset of the dependents’ options structs.
- Stream
Context - What a stream is about, for the span covering it.
- Stream
Progress - A snapshot of one stream’s accounting.
Enums§
- Counting
- Whether
instrumentshould count the items it sees. - Direction
- Which HTTP message the body belongs to.
- Side
- Which end of the connection this code is running on.
- Stream
Outcome - How a stream ended.
Constants§
- DEFAULT_
PROGRESS_ INTERVAL - Reported about once a second unless overridden.
Traits§
- Progress
Item - Lets
instrumentclassify items without being generic over the item type.
Functions§
- count_
bytes - Counts the bytes flowing through a byte stream.
- count_
items - Counts items flowing through an item stream, without touching errors or the outcome.
- instrument
- Reports errors, owns the outcome state machine, and optionally counts items.
Type Aliases§
- Stream
Error Handler - Called for every error reported by a stream.
- Stream
Progress Handler - Called for every progress report, interim and terminal.