Preserve distributed job context and expose grade 4 operational signals

This commit is contained in:
Artyom
2026-11-06 12:57:10 +03:00
parent 1a171d0d0f
commit 44d81fd80e
32 changed files with 1098 additions and 35 deletions
@@ -0,0 +1,26 @@
## ADDED Requirements
### Requirement: Durable distributed context
The system SHALL preserve W3C context through API, transactional outbox, relay producer and worker consumer including retries, and expose safe database and S3 client spans.
#### Scenario: Deferred delivery and retry
- **WHEN** an accepted upload is delivered after relay restart or retried after S3 failure
- **THEN** its producer and consumer spans share the originating trace and causally valid parents, without adding fields to the normative job payload
### Requirement: Operational signals and SLO
The system SHALL expose queue depth and oldest age, database pool usage and waiting, worker saturation, process CPU/RAM and durable time-to-ready; dashboards SHALL show histogram percentiles and error ratio and define availability and ready SLO windows.
#### Scenario: Stopped worker
- **WHEN** queued uploads wait for a stopped worker
- **THEN** depth and age increase, a queue-lag alert fires and resolves after recovery
#### Scenario: Unavailable database
- **WHEN** PostgreSQL becomes unavailable
- **THEN** API failure metrics and database client spans distinguish the dependency failure and an error-rate alert fires and resolves
### Requirement: Bounded observability failure
Collector SHALL use memory limits, batching and bounded queues; unavailable telemetry storage SHALL NOT prevent business requests or cause unbounded memory growth.
#### Scenario: Storage outage
- **WHEN** telemetry storage is stopped during requests
- **THEN** business smoke passes, measured memory remains within container limits, losses are recorded, and exports resume after recovery