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

Configure Feed

Select the types of activity you want to include in your feed.

feat: add query params to http span attributes

- http.search now shows: query, tag, platform filters
- http.similar now shows: uri

makes it easy to see what was searched at a glance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

zzstoatzz 9a0cc1eb 4d8bae1b

+15 -7
+15 -7
backend/src/server.zig
··· 78 78 const start_time = std.time.microTimestamp(); 79 79 defer timing.record(.search, start_time); 80 80 81 - const span = logfire.span("http.search", .{}); 82 - defer span.end(); 83 - 84 81 var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); 85 82 defer arena.deinit(); 86 83 const alloc = arena.allocator(); 87 84 88 - // parse query params: /search?q=something&tag=foo&platform=leaflet&since=2025-01-01 85 + // parse query params first so we can include them in the span 89 86 const query = parseQueryParam(alloc, target, "q") catch ""; 90 87 const tag_filter = parseQueryParam(alloc, target, "tag") catch null; 91 88 const platform_filter = parseQueryParam(alloc, target, "platform") catch null; 92 89 const since_filter = parseQueryParam(alloc, target, "since") catch null; 90 + 91 + const span = logfire.span("http.search", .{ 92 + .query = if (query.len > 0) query else null, 93 + .tag = tag_filter, 94 + .platform = platform_filter, 95 + }); 96 + defer span.end(); 93 97 94 98 if (query.len == 0 and tag_filter == null) { 95 99 try sendJson(request, "{\"error\":\"enter a search term\"}"); ··· 294 298 const start_time = std.time.microTimestamp(); 295 299 defer timing.record(.similar, start_time); 296 300 297 - const span = logfire.span("http.similar", .{}); 298 - defer span.end(); 299 - 300 301 var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); 301 302 defer arena.deinit(); 302 303 const alloc = arena.allocator(); 303 304 304 305 const uri = parseQueryParam(alloc, target, "uri") catch { 306 + const span = logfire.span("http.similar", .{}); 307 + defer span.end(); 305 308 try sendJson(request, "{\"error\":\"missing uri parameter\"}"); 306 309 return; 307 310 }; 311 + 312 + const span = logfire.span("http.similar", .{ 313 + .uri = uri, 314 + }); 315 + defer span.end(); 308 316 309 317 const results = search.findSimilar(alloc, uri, 5) catch { 310 318 try sendJson(request, "[]");