search for standard sites pub-search.waow.tech
search zig blog atproto

debug: add ACK diagnostic logging to tap consumer

Tracks ack_count and no_id_count to determine whether extractMessageId
returns null (no ACK sent) or ACKs are sent but not received by TAP.
Logs first 3 ACK payloads and first 5 no-id messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+13 -1
+13 -1
backend/src/ingest/tap.zig
··· 67 67 allocator: Allocator, 68 68 client: *websocket.Client, 69 69 msg_count: usize = 0, 70 + ack_count: usize = 0, 71 + no_id_count: usize = 0, 70 72 ack_buf: [64]u8 = undefined, 71 73 72 74 pub fn serverMessage(self: *Handler, data: []const u8) !void { 73 75 self.msg_count += 1; 74 76 if (self.msg_count % 1000 == 0) { 75 - logfire.info("tap: processed {d} messages", .{self.msg_count}); 77 + logfire.info("tap: processed {d} messages, acks sent: {d}, no-id: {d}", .{ self.msg_count, self.ack_count, self.no_id_count }); 76 78 } 77 79 78 80 // extract message ID for ACK ··· 87 89 // send ACK if we have a message ID 88 90 if (msg_id) |id| { 89 91 self.sendAck(id); 92 + } else { 93 + self.no_id_count += 1; 94 + if (self.no_id_count <= 5) { 95 + logfire.warn("tap: message has no id, first {d} bytes: {s}", .{ @min(data.len, 100), data[0..@min(data.len, 100)] }); 96 + } 90 97 } 91 98 } 92 99 ··· 97 104 }; 98 105 self.client.write(@constCast(ack_json)) catch |err| { 99 106 logfire.err("tap: failed to send ACK: {}", .{err}); 107 + return; 100 108 }; 109 + self.ack_count += 1; 110 + if (self.ack_count <= 3) { 111 + logfire.info("tap: ACK sent for id={d}, ack_json={s}", .{ msg_id, ack_json }); 112 + } 101 113 } 102 114 103 115 pub fn close(_: *Handler) void {}