api_request_completed: from owned boundary to trusted query
Treat api_request_completed as a durable analytical contract: the owner emits one documented grain, a fixture proves the fields, and a reviewed query answers the stated question.
- 1
Outcome becomes final
HTTP middleware at request completion emits only after the final response status and latency are known.
- 2
Contract is bounded
9 required fields preserve the declared grain: One completed API request.
- 3
Fixture is verified
Check types, UTC time, alternate outcomes, idempotency, and every pseudonymous or review-classified field.
- 4
Question is answered
Where do errors and slow requests affect customers?
Grain
One completed API request.
Owner
HTTP middleware at request completion
Emit when
After the final response status and latency are known.
Field contract
Typed fields with explicit privacy boundaries
Keep existing field names and types stable after production queries depend on them. Optional context should remain bounded, documented, and justified by a specific decision.
| Field | Type | Required | Privacy | Meaning |
|---|---|---|---|---|
| timestamp_utc | timestamp | yes | non-sensitive | UTC time at the outcome boundary. |
| event_id | string | yes | non-sensitive | Stable unique identifier used for deduplication. |
| release | string | yes | non-sensitive | Application or service version that emitted the event. |
| account_id | string | yes | pseudonymous | Stable internal account identifier, never an email or name. |
| request_id | string | yes | pseudonymous | Correlation identifier; do not expose auth material. |
| route | string | yes | non-sensitive | Low-cardinality route template such as /v1/query/:id. |
| method | string | yes | non-sensitive | HTTP method. |
| status_code | number | yes | non-sensitive | Final HTTP response status. |
| latency_ms | number | yes | non-sensitive | End-to-end duration in milliseconds. |
| error_type | string | no | non-sensitive | Bounded failure category; omit stack traces and payloads. |
Synthetic JSON event
{
"timestamp_utc": "2026-07-28T14:15:06Z",
"event_id": "evt_api_01",
"account_id": "acct_8f31",
"release": "2026.07.2",
"request_id": "req_2f71",
"route": "/v1/query/:id",
"method": "POST",
"status_code": 200,
"latency_ms": 184
}Privacy review
Review identifiers before ingestion
This example uses synthetic identifiers. Pseudonymous values can still be personal data, and review fields can expose business or provider context. Apply your own consent, retention, access, residency, and deletion requirements.
account_id: pseudonymousrequest_id: pseudonymous
Validation checklist
Prove the contract before building a dashboard
- Send one known api_request_completed fixture after the documented outcome boundary.
- Verify all 9 required fields arrive with the documented types.
- Retry the same event identifier and confirm the chosen deduplication behavior.
- Send a controlled failure or alternate outcome when the workflow supports one.
- Run the related SQL over a fixed window and reconcile the result to the fixture.
Common mistakes
Keep one row equal to one durable outcome
- Emitting api_request_completed before http middleware at request completion knows the final outcome.
- Mixing several grains in one table, which makes counts and rates ambiguous.
- Replacing controlled categories with raw URLs, payloads, prompts, or error text.
- Changing a field type in place after saved queries and dashboards depend on it.
- Adding identifiers without a documented investigation, access, and retention need.
Use the contract
Query and operationalize the event
Related contracts
Send a fixture before production traffic
Create a free API key, send the synthetic event, and inspect the inferred table before connecting a live workflow.