logfire client for zig

update readme with instrumentation helpers and batch export

+17
+17
README.md
··· 77 77 ## Features 78 78 79 79 - **Spans** - timing and tracing with attributes, automatic parent-child linking 80 + - **Instrumentation helpers** - `httpSpan()` and `sqlSpan()` for common patterns 81 + - **Async batched export** - BatchSpanProcessor exports every 500ms (matches Python/Rust) 80 82 - **Logging** - trace, debug, info, warn, err (console output) 81 83 - **OTLP Export** - HTTP/protobuf via otel-zig to Logfire or any OTLP-compatible backend 82 84 - **Zero Config** - reads token and endpoint from environment ··· 102 104 // add attributes after creation 103 105 span.setAttribute("result_count", @as(i64, 42)); 104 106 107 + // record errors (sets error status + adds exception event) 108 + span.recordError(error.ConnectionFailed); 109 + 110 + // instrumentation helpers for common patterns 111 + const http_span = logfire.httpSpan("GET", "/api/users", .{}); 112 + defer http_span.end(); 113 + // creates span named "HTTP GET /api/users" with http.request.method and url.path attrs 114 + 115 + const db_span = logfire.sqlSpan("SELECT * FROM users WHERE id = ?", "postgresql"); 116 + defer db_span.end(); 117 + // creates span with truncated SQL name and db.system attribute 118 + 105 119 // logging (console output only for now) 106 120 logfire.trace("detailed trace", .{}); 107 121 logfire.debug("debug info", .{}); ··· 139 153 140 154 - [x] Spans with attributes 141 155 - [x] Parent-child span linking (thread-local context) 156 + - [x] Error recording (`span.recordError()`) 142 157 - [x] OTLP HTTP/protobuf export 158 + - [x] Async batched export (500ms interval, matches Python/Rust) 143 159 - [x] Environment-based configuration 160 + - [x] Instrumentation helpers (`httpSpan`, `sqlSpan`) 144 161 - [x] Cross-platform (macOS + Linux) 145 162 - [ ] Structured logging export (console only, OTLP TODO) 146 163 - [ ] Metrics (API stubs, implementation TODO)