Event Envelope Standardı
Bu doküman, Qapu sistemindeki tüm Kafka eventleri için geçerli olan zorunlu zarf (envelope) yapısını tanımlar. Her servisin event kataloğu bu dizin altındaki alt sayfalarda tutulur.
Topic Standardı
Bu sayfa yalnız envelope yapısını tanımlar. Topic adlandırma, DLQ politikası ve retention kuralları için Kafka Topic Standard sayfasına bakınız.
Kapsam
- Bu sayfa, sistem genelindeki tüm eventlerin paylaştığı zarf yapısının tek kaynak referansıdır.
- Her servis kendi event içeriğini (
databloğu) kendievent-contractsdokümanında tanımlar. - Bu dizin altındaki sayfalar, event bazlı çapraz referans (topic, producer, consumer) kataloğudur.
Zorunlu Envelope Yapısı
{
"event": "service.action.v1",
"meta": {
"trace_id": "abc-1234",
"producer_service": "service-name",
"produced_at": "2026-04-15T10:00:00.000Z",
"process_ms": 12
},
"context": {},
"data": {},
"error": null
}
Alan Tanımları
Üst Düzey Alanlar
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
event | string | Evet | Globally unique event adı: <service>.<action>.v<n> |
meta | object | Evet | Teknik metadata bloğu |
context | object | Evet | İş bağlamı (cihaz, stream, SIM vb.) |
data | object | Evet | Event'e özgü payload; event türüne göre şema değişir |
error | object | null | Evet | Hata durumunda doldurulur; başarılı eventta null |
meta Alanları
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
meta.trace_id | string (UUID v7) | Evet | Dağıtık izleme kimliği; event zinciri boyunca sabit taşınır. Ingest servisi oluşturur; downstream servisler pass-through yapar |
meta.producer_service | string | Evet | Üretici servis kimliği (örn: ingest-service) |
meta.produced_at | datetime (ISO 8601) | Evet | Event üretim zamanı (UTC) |
meta.process_ms | integer | Hayır | Servisin bu event için uçtan uca işlem süresi |
context Alanları
Tüm eventlerde aşağıdaki şema kullanılır. Null atanabilen alanlar ilgili flowda null olur.
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
context.device_id | string | Evet | Cihazın DS28C kimliği |
context.raw_id | integer | null | Hayır | Raw pakete ait raw_packets.id |
context.stream_id | integer | null | Hayır | Stream adım kaydına ait streams.id |
context.device_time | datetime (ISO 8601) | Evet | Cihazdan gelen ölçüm/event zamanı |
context.stream_time | datetime (ISO 8601) | null | Hayır | Servis tarafında kaydın işleme zamanı |
context.iccid | string | null | Hayır | SIM'in ICCID'si (heartbeat/connectivity) |
context.imei | string | null | Hayır | Modem IMEI numarası |
context.firmware | string | null | Hayır | Cihazda çalışan firmware versiyonu |
error Alanı (Hata Eventlerinde)
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
error.code | string | Evet | Makineyle okunabilir hata kodu |
error.message | string | Evet | İnsan okunabilir açıklama |
error.stage | string | Evet | Hatanın oluştuğu servis aşaması |
error.retryable | boolean | Evet | Yeniden denenebilir mi? |
Event Adlandırma Kuralı
Format: <service>.<action>.v<n>
<service>: Üretici servisin canonical adı (örn:stream,calibration,window)<action>: İşin sonucunu tanımlayan kısa eylem (örn:created,ready,failed,committed)v<n>: Semantik versiyon; breaking payload değişikliğinde arttırılır
Örnekler:
stream.created.v1calibration.ready.v1window.ready.v1egress.sent.v1
Versiyon Politikası
- Mevcut bir event'e zorunlu olmayan yeni alan eklenmesi breaking change değildir;
v1devam eder. - Mevcut alanlarda tip değişikliği, alan silinmesi veya zorunlu alan eklenmesi breaking change'dir → event adı
v2olur. v1vev2bir süre birlikte taşınabilir; consumer geçişi tamamlanana kadar producer her ikisini de üretebilir.
Event Kataloğu
Aşağıdaki tablo sistemdeki tüm eventleri servis ve topic bazlı özetler. Detaylar ilgili servis sayfasında bulunur.
| Event | Topic | Producer | Başlıca Consumer |
|---|---|---|---|
ingest.accepted.v1 | qapu.ingest | Ingest | Stream |
device.ingest_duplicate_detected.v1 | qapu.ingest | Ingest | Observer/Ops |
stream.created.v1 | qapu.stream | Stream | Calibration |
stream.failed.v1 | qapu.stream | Stream | Observer |
device.inventory.created.v1 | qapu.stream | Stream | Audit |
device.inventory.updated.v1 | qapu.stream | Stream | Audit |
modem.inventory.created.v1 | qapu.stream | Stream | Audit |
device.modem.changed.v1 | qapu.stream | Stream | Audit |
sim.inventory.created.v1 | qapu.stream | Stream | Audit |
device.sim.changed.v1 | qapu.stream | Stream | Audit |
device.firmware.recorded.v1 | qapu.stream | Stream | Audit |
device.firmware.changed.v1 | qapu.stream | Stream | Audit |
stream.message_type.unmapped.v1 | qapu.stream | Stream | Ops |
calibration.ready.v1 | qapu.calibration | Calibration | Raw Writer |
calibration.failed.v1 | qapu.calibration | Calibration | Observer |
raw.persisted.v1 | qapu.raw-writer | Raw Writer | Synthesis |
raw.failed.v1 | qapu.raw-writer | Raw Writer | Observer |
synth.ready.v1 | qapu.synthesis | Synthesis | Window |
synth.failed.v1 | qapu.synthesis | Synthesis | Observer |
window.ready.v1 | qapu.window | Window | Rule, Egress, Ledger, API |
window.failed.v1 | qapu.window | Window | Observer |
rule.triggered.v1 | qapu.rule | Rule | Action |
rule.reset.v1 | qapu.rule | Rule | Action |
rule.completed.v1 | qapu.rule | Rule | Observer |
action.execute.requested.v1 | qapu.action | Rule/Action | Communication, Action |
action.executed.v1 | qapu.action | Action | Observer |
action.failed.v1 | qapu.action | Action | Observer |
communication.sent.v1 | qapu.communication | Communication | Automation, Observer |
communication.failed.v1 | qapu.communication | Communication | Observer |
automation.command.requested.v1 | qapu.automation | Automation | Communication, Egress |
automation.job.completed.v1 | qapu.automation | Communication | Automation, Egress |
automation.job.failed.v1 | qapu.automation | Communication/Automation | Observer, Egress |
heartbeat.metrics.updated.v1 | qapu.heartbeat | Heartbeat | Observer, API |
heartbeat.status.changed.v1 | qapu.heartbeat | Heartbeat | Observer, Alarm |
heartbeat.failed.v1 | qapu.heartbeat | Heartbeat | Observer |
observer.buffer.duplicate.v1 | qapu.observer | Observer | Dashboard, Audit |
observer.buffer.replaced.v1 | qapu.observer | Observer | Dashboard, Audit |
observer.retry.requested.v1 | qapu.observer | Observer | Retry Worker |
observer.escalated.v1 | qapu.observer | Observer | AlertingSystem, Dashboard |
observer.completed.v1 | qapu.observer | Observer | Analytics, Dashboard |
ledger.committed.v1 | qapu.ledger | Ledger | Observer, Egress, Audit |
ledger.failed.v1 | qapu.ledger | Ledger | Observer |
egress.sent.v1 | qapu.egress | Egress | Observer |
egress.failed.v1 | qapu.egress | Egress | Observer, DLQ |
firmware.download.completed.v1 | qapu.fota | FOTA | Observer |
firmware.download.failed.v1 | qapu.fota | FOTA | Observer |