Skip to main content

Module progress

Module progress 

Source
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-streamsprogress.rs and reqwest-streamsobservability.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§

ErrorInfo
What the accounting needs to know about an error passing through a stream.
Progress
The accounting handle threaded through one stream’s pipeline.
ProgressOptions
The direction-neutral subset of the dependents’ options structs.
StreamContext
What a stream is about, for the span covering it.
StreamProgress
A snapshot of one stream’s accounting.

Enums§

Counting
Whether instrument should count the items it sees.
Direction
Which HTTP message the body belongs to.
Side
Which end of the connection this code is running on.
StreamOutcome
How a stream ended.

Constants§

DEFAULT_PROGRESS_INTERVAL
Reported about once a second unless overridden.

Traits§

ProgressItem
Lets instrument classify 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§

StreamErrorHandler
Called for every error reported by a stream.
StreamProgressHandler
Called for every progress report, interim and terminal.