Repository navigation
feat(server): add optional OTLP traces and correlated JSON logs - #1001
aaltshuler wants to merge 7 commits into
Conversation
|
This change gives operators request traces and JSON logs they can join to a caller trace. Text logs stay the default. Export stays off until an OTLP HTTP/protobuf endpoint is set. The binary installs that subscriber from Keep this pull request in draft until the three blocking items are fixed and the branch is rebased onto current Blocking1. The log filter also disables trace export
The guide treats Class: every The formatter owns logs. Put one per-layer filter on the fmt layer. That filter applies A local experiment stacked two Liability removed: a quiet log setting deletes traces and reports success. Liability added: the formatter filter and the export filter must stay on different layers. The next signal (metrics, OTLP logs) adds a processor or a layer and leaves this split in place. Five more global filters would make each signal depend on the quietest one. 2. JSON trace correlation is tied to the exporter
The guide says JSON logs include Class: every JSON log inside a request span while export is off, including the documented completion record. Build a
Liability removed: operators can join a JSON line to the caller trace while export is off. Liability added: a tracer and span extensions on each request while export is off. The cost is memory and CPU. There is no I/O. That cost matches the log contract. Correctness comes before the idle-path allocations. 3. Rebase onto current main conflicts, and a bad resolution drops request facts
The same four files conflicted with Owned write. Current Keep Owned read. Current Keep
The Optional
The HTTP exporter reads The HTTP span stays open until owned child spans close. The registry holds a parent reference for the child.
An unrecognized
This change does not install a Lance metrics recorder. Lance observability on the current guide is a metrics facade. A later metrics change should use that recorder and TradeoffThe design is small: one subscriber, one optional batch processor, one JSON formatter. That shape is right. The liability is that three contracts share switches: log level with export, correlation with the endpoint, and The privacy bounds in this change should stay on that builder: the target allowlist, the Checked, and left as-isJSON completion records include the route template and method under
Dropping the handler span leaves the request span in the child scope. The registry parent reference keeps it. The owned-operation parent test passed.
Malformed Tests to addA
On ValidationHead reviewed: Failure, current subscriber, tests added locally:
Result: 5 passed, 2 failed, 206 filtered out. Success, temporary fix only, then restored. Same package and flags, plus Result: 8 passed, 0 failed, 205 filtered out. LimitationsI did not rerun the workspace CI graph. I did not re-check the PR body's CI claim. I did not run the full Inline comments that could not be attached
|
31c9f29 to
ef26389
Compare
Owned server operations can outlive the initiating request, but existing HTTP logs do not provide collector-ready trace context for that work. This adds optional OTLP HTTP/protobuf export and correlated JSON logs. Text logs and disabled export remain the defaults; exporting requires an explicit endpoint.
Request spans record route templates, methods, status and time to response headers. Owned read/write spans preserve request ancestry and bounded outcomes. Export admits only authored telemetry targets; logs retain the existing MCP/Lance payload restrictions. Bodies, credentials, query strings and path parameters are excluded.
RUST_LOGcontrols log events independently of trace export, while warning and error logs retain their enclosing trace IDs when INFO logging is suppressed.The expanded HTTP/owned-operation regression failed before the filter repair with zero exported spans instead of three. It now passes for INFO, WARN, ERROR and OFF JSON logging and WARN text logging, including parent context, correlation and private-payload canaries. All 222 server library tests and the executable test pass; two subprocess helper tests remain intentionally ignored and are exercised by their parent tests. Existing coverage includes real protobuf export to a loopback collector, malformed context, scoped publication uncertainty and unchanged admission. This revision integrates main at
3602c308, including Tokio 1.53.3, and reports development version 0.14.1.For review: telemetry is best effort, with a bounded queue and independent exporter timeout. Its background flush does not extend native shutdown deadlines, and buffered spans may be lost at process exit. It is correlation, never durable operation evidence or authority. Storage and authorization contracts remain unchanged. This PR remains a draft.