Files
mtusi2026lab6/ARCHITECTURE.md
T

1.6 KiB

Сигналы поверх устойчивого messenger

flowchart LR
  C[Client] --> H[HAProxy]
  H --> A[API x2]
  A --> P[(PostgreSQL + outbox)]
  A --> S[(S3 staging)]
  P --> D[Dispatcher]
  D --> B[(Valkey Streams)]
  B --> W[Worker]
  W --> S
  W --> P
  A -. OTLP HTTP .-> O[Collector memory limiter + batch]
  D -. OTLP HTTP .-> O
  W -. OTLP HTTP .-> O
  O --> M[Prometheus scrape]
  O --> L[Loki OTLP logs]
  O --> T[Tempo OTLP traces]
  M --> G[Grafana]
  L --> G
  T --> G

API durable-accept span → W3C traceparent/tracestate in PostgreSQL job → dispatcher PRODUCER → broker envelope → worker CONSUMER → image.render / S3 / DB commit. Retry preserves the original trace and creates a new producer/consumer attempt. Technical IDs are permitted only in synthetic logs, never metric labels. Histograms use seconds; application RSS bytes, CPU cumulative seconds.

The business path does not synchronously wait for exporters. SDK queues are bounded256 records, export batches64, timeout2s. Collector has memory_limiter192MiB,256MiB container, batch128 maximum, separate32-batch queues for Loki and Tempo, retry max30s. Telemetry loss during prolonged outages is an explicit tradeoff; PostgreSQL/S3 durability is independent.

Application limits, outbox/fencing/image versioning from Lab5 remain. Grafana, Prometheus, Loki and Tempo persist in separate named volumes. All published ports bind127.0.0.1; OTLP4318 and S3/broker/DB are bridge-only. Grafana password is generated into an ignored local file. Initialization changes ownership only of the four named telemetry mount roots; regular applications run without root capabilities.