forked from mtusi2026/mtusi2026lab6
Implement lab6 observability with OpenTelemetry and Grafana
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
-- Same transaction creates message and idempotency receipt. Unique key arbitrates concurrent replicas.
|
||||
CREATE TABLE IF NOT EXISTS message_idempotency (
|
||||
actor_id UUID NOT NULL REFERENCES users(id),
|
||||
chat_id UUID NOT NULL REFERENCES chats(id),
|
||||
method VARCHAR(8) NOT NULL DEFAULT 'POST',
|
||||
idem_key VARCHAR(128) NOT NULL,
|
||||
body_sha256 CHAR(64) NOT NULL,
|
||||
message_id UUID NOT NULL REFERENCES messages(id),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
|
||||
PRIMARY KEY (actor_id, chat_id, method, idem_key)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_idempotency_age ON message_idempotency (created_at);
|
||||
Reference in New Issue
Block a user