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 allocator: Allocator, 68 client: *websocket.Client, 69 msg_count: usize = 0, 70 ack_buf: [64]u8 = undefined, 71 72 pub fn serverMessage(self: *Handler, data: []const u8) !void { 73 self.msg_count += 1; 74 if (self.msg_count % 1000 == 0) { 75 - logfire.info("tap: processed {d} messages", .{self.msg_count}); 76 } 77 78 // extract message ID for ACK ··· 87 // send ACK if we have a message ID 88 if (msg_id) |id| { 89 self.sendAck(id); 90 } 91 } 92 ··· 97 }; 98 self.client.write(@constCast(ack_json)) catch |err| { 99 logfire.err("tap: failed to send ACK: {}", .{err}); 100 }; 101 } 102 103 pub fn close(_: *Handler) void {}
··· 67 allocator: Allocator, 68 client: *websocket.Client, 69 msg_count: usize = 0, 70 + ack_count: usize = 0, 71 + no_id_count: usize = 0, 72 ack_buf: [64]u8 = undefined, 73 74 pub fn serverMessage(self: *Handler, data: []const u8) !void { 75 self.msg_count += 1; 76 if (self.msg_count % 1000 == 0) { 77 + logfire.info("tap: processed {d} messages, acks sent: {d}, no-id: {d}", .{ self.msg_count, self.ack_count, self.no_id_count }); 78 } 79 80 // extract message ID for ACK ··· 89 // send ACK if we have a message ID 90 if (msg_id) |id| { 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 + } 97 } 98 } 99 ··· 104 }; 105 self.client.write(@constCast(ack_json)) catch |err| { 106 logfire.err("tap: failed to send ACK: {}", .{err}); 107 + return; 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 + } 113 } 114 115 pub fn close(_: *Handler) void {}