stormlog.infer.populations
Who a case’s numbers are about, and the interval its rates divide by.
A case’s measured requests are its cohort. Their statuses split the cohort into explicit populations (offered, dropped, sent, unreachable, delivery_unknown, rejected, accepted, successful, failed, timed out, cancelled), each counted once, and the cohort is checked for the records a run should have: unique identities, every scheduled arrival exactly once, and times inside the case’s window. A duplicated record cannot stand in for a missing one.
Rates divide by an interval named by what it is. An open loop’s rate counts the requests scheduled in its window, however late they finished, per second of the schedule’s own window, which ends where the schedule does and not where sending happened to end. A closed loop’s rate counts every measured request per second from the start of the phase to the end of its drain.
Functions
|
Each measured case's cohort, populations and intervals. |
|
Count requests by status; the identities in |
|
Judge a case's offered requests against |
|
|
Classes
|
The interval rates divide by, and the others a reader may want. |
|
|
|
A span of client wall time, named by kind and by what it counts. |
|
A cohort's requests by what happened to them. |
|
A slice of a case, by offsets from its measured phase's start. |
|
The requests that belong to one segment, and the segment's interval. |
- class stormlog.infer.populations.CaseIntervals(rate, scheduled_window=None, dispatch_window=None, drain=None, measured_span=None, configured_rate_per_second=None, realized_offered_rate_per_second=None, rate_reason=None)[source]
Bases:
objectThe interval rates divide by, and the others a reader may want.
rateis the scheduled window for an open loop, the measured span for a closed loop, and the span of the recorded requests for an artifact older than phase windows. It is None for an open loop whose schedule has no known end, and for a phase that never recorded its window, or recorded one without bounds.rate_reasonsays why it is not the first choice when it is not.- Parameters:
rate (MeasuredInterval | None)
scheduled_window (MeasuredInterval | None)
dispatch_window (MeasuredInterval | None)
drain (MeasuredInterval | None)
measured_span (MeasuredInterval | None)
configured_rate_per_second (float | None)
realized_offered_rate_per_second (float | None)
rate_reason (str | None)
- rate: MeasuredInterval | None
- scheduled_window: MeasuredInterval | None = None
- dispatch_window: MeasuredInterval | None = None
- drain: MeasuredInterval | None = None
- measured_span: MeasuredInterval | None = None
- configured_rate_per_second: float | None = None
- realized_offered_rate_per_second: float | None = None
- rate_reason: str | None = None
- class stormlog.infer.populations.CasePopulation(case_id: 'str', population: 'Population', intervals: 'CaseIntervals', segments: 'Mapping[str, SegmentPopulation]' = <factory>)[source]
Bases:
object- Parameters:
case_id (str)
population (Population)
intervals (CaseIntervals)
segments (Mapping[str, SegmentPopulation])
- case_id: str
- population: Population
- intervals: CaseIntervals
- segments: Mapping[str, SegmentPopulation]
- class stormlog.infer.populations.MeasuredInterval(kind, started_at_ns, ended_at_ns, numerator_cohort)[source]
Bases:
objectA span of client wall time, named by kind and by what it counts.
- Parameters:
kind (Literal['scheduled_window', 'measured_span', 'dispatch_window', 'drain', 'request_span', 'segment'])
started_at_ns (int)
ended_at_ns (int)
numerator_cohort (Literal['arrival_cohort', 'all_measured', 'overlapping'])
- kind: Literal['scheduled_window', 'measured_span', 'dispatch_window', 'drain', 'request_span', 'segment']
- started_at_ns: int
- ended_at_ns: int
- numerator_cohort: Literal['arrival_cohort', 'all_measured', 'overlapping']
- property seconds: float | None
Its length; None when it is empty, so nothing divides by zero.
- class stormlog.infer.populations.Population(offered, scheduled, dropped, sent, unreachable, delivery_unknown, rejected, accepted, successful, failed, timed_out, cancelled, other=<factory>, server_admitted=None, server_evidence_coverage=None, cohort_valid=True, issues=())[source]
Bases:
objectA cohort’s requests by what happened to them.
offered = dropped + sent;sent = unreachable + delivery_unknown + rejected + accepted;accepted = successful + failed + timed_out + cancelled + sum(other).acceptedis the client’s view: nothing refused it.server_admittedcounts requests the server confirmed it saw, through a joined span or execution record; it is None when the run has no such evidence at all.- Parameters:
offered (int)
scheduled (int | None)
dropped (int)
sent (int)
unreachable (int)
delivery_unknown (int)
rejected (int)
accepted (int)
successful (int)
failed (int)
timed_out (int)
cancelled (int)
other (Mapping[str, int])
server_admitted (int | None)
server_evidence_coverage (float | None)
cohort_valid (bool)
issues (tuple[str, ...])
- offered: int
- scheduled: int | None
- dropped: int
- sent: int
- unreachable: int
- delivery_unknown: int
- rejected: int
- accepted: int
- successful: int
- failed: int
- timed_out: int
- cancelled: int
- other: Mapping[str, int]
- server_admitted: int | None = None
- server_evidence_coverage: float | None = None
- cohort_valid: bool = True
- issues: tuple[str, ...] = ()
- property censored: int
Requests whose latency is known only to exceed what was observed.
- class stormlog.infer.populations.Segment(name, start_offset_ns, end_offset_ns)[source]
Bases:
objectA slice of a case, by offsets from its measured phase’s start.
- Parameters:
name (str)
start_offset_ns (int)
end_offset_ns (int)
- name: str
- start_offset_ns: int
- end_offset_ns: int
- class stormlog.infer.populations.SegmentPopulation(population, interval, membership)[source]
Bases:
objectThe requests that belong to one segment, and the segment’s interval.
- Parameters:
population (Population)
interval (MeasuredInterval)
membership (Literal['arrival', 'overlap'])
- population: Population
- interval: MeasuredInterval
- membership: Literal['arrival', 'overlap']
- stormlog.infer.populations.case_populations(records, *, segments=(), membership='arrival', server_admitted_ids=None)[source]
Each measured case’s cohort, populations and intervals.
server_admitted_idsare thex_request_idvalues the server confirmed it saw. Segmentmembershipisarrival(by intended arrival, falling back to the send time) oroverlap(any request whose span meets the segment).- Parameters:
records (Sequence[Mapping[str, Any]])
segments (Sequence[Segment])
membership (Literal['arrival', 'overlap'])
server_admitted_ids (Collection[str] | None)
- Return type:
dict[str, CasePopulation]
- stormlog.infer.populations.count_population(requests, *, scheduled=None, server_admitted_ids=None, issues=(), cohort_valid=True)[source]
Count requests by status; the identities in
Populationalways hold.- Parameters:
requests (Iterable[Mapping[str, Any]])
scheduled (int | None)
server_admitted_ids (Collection[str] | None)
issues (Sequence[str])
cohort_valid (bool)
- Return type:
- stormlog.infer.populations.goodput(requests, spec, interval, *, spans=None, slo_source='flags', cohort=None)[source]
Judge a case’s offered requests against
spec; rates perinterval.requestsare the case’s measured requests, dropped ones included;spansare their joined vLLM spans, for server criteria;cohortis their population, whose validity the evaluation carries.- Parameters:
requests (Sequence[Mapping[str, Any]])
spec (SloSpec)
interval (MeasuredInterval | None)
spans (JoinedSpans | None)
slo_source (str)
cohort (Population | None)
- Return type:
- stormlog.infer.populations.rate(count, interval)[source]
countper second ofinterval; None when it has no length.- Parameters:
count (float)
interval (MeasuredInterval | None)
- Return type:
float | None