Index

public.suotar_api_calls

Description

One row per HTTP call to Suotar, per batch rather than per item. Gives latency percentiles and error rate by endpoint without adding a metrics system. Retention is 90 days and the stored bodies are scrubbed; both, not either.

Columns

Name Type Default Nullable Children Parents Comment
created_at timestamp with time zone now() false Timestamp when the record was created.
credit_registration_ids uuid[] ‘{}’::uuid[] false The ledger rows this call covered, in request item id order. This is the replacement for the personal data removed from the bodies: debugging walks body to registration id to ledger row, where the real values are held in exactly one place.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
duration_ms integer true Wall-clock duration of the call in milliseconds.
endpoint suotar_endpoint false Which Suotar endpoint was called.
error_item_count integer 0 false How many items the response rejected.
error_message text true Request-level error detail, scrubbed before storage.
http_status integer true HTTP status returned. NULL when the request never got a response.
id uuid uuid_generate_v4() false public.credit_registration_events A unique, stable identifier for the record.
ok_item_count integer 0 false How many items the response accepted.
request_body_sample jsonb true Scrubbed sample of the request body: full body for at most 20 items, otherwise the first 5 plus a count, truncated to 64 kB. scrub_suotar_body redacts at write time on a best-effort basis: student numbers, email addresses, access tokens and the known person fields go, while a personal name quoted in a free-text error message is deliberately kept because the study registry holds it anyway. Keys are kept so the payload shape stays debuggable. Rows here are swept after 90 days.
request_item_count integer false How many items the batch carried.
request_level_error_code varchar(64) true The code returned when the whole request was rejected rather than individual items.
response_body_sample jsonb true Scrubbed sample of the response body, same rules as request_body_sample.
started_at timestamp with time zone false When the request was sent. The retention sweep works on this.
succeeded boolean false Whether the call itself succeeded at the request level. Per-item errors do not make a call unsuccessful.
updated_at timestamp with time zone now() false Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.
worker_name varchar(64) false Which worker or manual action made the call, so the submitter, the verify poller and an admin retry are distinguishable.

Viewpoints

Name Definition
Credit registration How a completed course module becomes a credit in the University of Helsinki study registry. Enrolment on the course is itself the student’s consent to register the credit; once a student number is proven to be theirs, one ledger row per completion is pushed to Sisu through Suotar and polled until the registry confirms the attainment.

Constraints

Name Type Definition
suotar_api_calls_created_at_not_null n NOT NULL created_at
suotar_api_calls_credit_registration_ids_not_null n NOT NULL credit_registration_ids
suotar_api_calls_endpoint_not_null n NOT NULL endpoint
suotar_api_calls_error_item_count_not_null n NOT NULL error_item_count
suotar_api_calls_id_not_null n NOT NULL id
suotar_api_calls_ok_item_count_not_null n NOT NULL ok_item_count
suotar_api_calls_pkey PRIMARY KEY PRIMARY KEY (id)
suotar_api_calls_request_item_count_not_null n NOT NULL request_item_count
suotar_api_calls_started_at_not_null n NOT NULL started_at
suotar_api_calls_succeeded_not_null n NOT NULL succeeded
suotar_api_calls_updated_at_not_null n NOT NULL updated_at
suotar_api_calls_worker_name_not_null n NOT NULL worker_name

Indexes

Name Definition
idx_suotar_api_calls_endpoint_started CREATE INDEX idx_suotar_api_calls_endpoint_started ON public.suotar_api_calls USING btree (endpoint, started_at DESC)
idx_suotar_api_calls_endpoint_successes CREATE INDEX idx_suotar_api_calls_endpoint_successes ON public.suotar_api_calls USING btree (endpoint, started_at DESC) WHERE succeeded
idx_suotar_api_calls_failures CREATE INDEX idx_suotar_api_calls_failures ON public.suotar_api_calls USING btree (started_at DESC) WHERE (NOT succeeded)
idx_suotar_api_calls_registration_ids CREATE INDEX idx_suotar_api_calls_registration_ids ON public.suotar_api_calls USING gin (credit_registration_ids)
idx_suotar_api_calls_started CREATE INDEX idx_suotar_api_calls_started ON public.suotar_api_calls USING btree (started_at DESC)
suotar_api_calls_pkey CREATE UNIQUE INDEX suotar_api_calls_pkey ON public.suotar_api_calls USING btree (id)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.suotar_api_calls FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls