Skip to main content

Module suotar_api_calls

Module suotar_api_calls 

Source
Expand description

Per-request observability for calls to Suotar.

Bodies must be scrubbed with crate::credit_registration_events::scrub_suotar_body before insert; credit_registration_ids replaces the removed identifiers for drill-down.

Structs§

FinishedSuotarApiCall
What only the response knows. The row itself is inserted before the request leaves.
NewSuotarApiCall
PgSuotarCallAudit
Audits every headless_lms_utils::services::suotar::SuotarClient call.
SuotarApiCall
SuotarApiCallFilters
The narrowings the API log applies, all of them in SQL.
SuotarApiCallPageRow
A call with the page’s total attached, so a page and its count cannot come from two queries.
SuotarEndpointStanding
Where one endpoint stands right now.
SuotarEndpointStatsForWindow
One endpoint’s traffic over a window, one of possibly several computed together by get_endpoint_stats_for_windows.
SuotarFailureRun
A run of failures the health rules key on.

Enums§

SuotarEndpoint
Re-exported so row readers keep one import path; the enum lives with the client that calls the endpoints, which also stores it in the suotar_endpoint postgres enum.

Constants§

BODY_SAMPLE_MAX_BYTES
Hard cap on a stored body, applied after sampling.
FULL_BODY_ITEM_LIMIT
Bodies are sampled in full up to this many items.
RETENTION_DAYS
How long call rows are kept.
SAMPLED_BODY_ITEM_COUNT
Above FULL_BODY_ITEM_LIMIT, only this many items are kept plus a count.

Functions§

count_credential_rejections_since
Calls Suotar refused our credentials on. One is enough to stop everything registering.
count_unreachable_run_since
The unbroken run of “Suotar did not answer usefully” at the end of the window. A transport failure carries no HTTP status, which is how it is told from a refusal Suotar composed itself.
delete_older_than
Hard-deletes rows past the retention window: the stored bodies must stop existing.
finish
get_by_credit_registration_id
Calls that mention a ledger row, for the per-item drill-down.
get_by_id
get_endpoint_standings
Bounded to the last RETENTION_DAYS: this table grows one row per Suotar batch call, and the Overview and the health tab each poll this every 30 seconds.
get_endpoint_stats_for_windows
One scan of the table joined against the window list, so several windows cost one pass rather than one full pass each. A single window is just a one-element window_secs.
get_page
A page of the call log, newest first, without bodies. See get_by_id for a call’s bodies.
get_worker_names
The distinct worker_name values in the log, so the filter offers what exists rather than a hardcoded list of phase names.
insert
sample_body
Shortens an already-scrubbed body to what this table keeps: whole while the batch is small, then the leading items plus a count, then nothing but the measurements.