Skip to main content

Module trace

Module trace 

Source
Expand description

What this service is doing, and what every service has done: metrics, traces and the log tail.

§Two halves, and only one of them was reachable

Publishing already worked from gs: metric and as_name wrap methods the context has always carried, and the SDK instruments every request and reply on its own. What had no route was reading any of it back. The query side is a wire protocol spoken to the events service - an opcode byte out, a packed reply in - and a program that wanted the numbers had to import godspeed_sdk, hand-assemble the request and decode fixed-width fields itself. That is exactly the kind of protocol this library exists to hide, the same way crate::fs hides the filesystem’s.

§Everything here answers with a Table

Not a printed grid and not JSON. The table is the truth and a rendering is a view of it (Commandment III), so a caller sorts, filters or aggregates first and renders once:

ⓘ
let mut t = gs::trace::metrics(&ctx)?;
t.filter("owner", "=", "fs");
t.sort("value", true);
t.to_grid(&mut sink);

§The log tail here is a CONVENIENCE, not the log

Every line logs returns also went to serial and the kernel ring the moment it was written, by syscall, before events ever saw a copy (CLAUDE.md 11.4). Serial is complete; this window is not. It cannot show anything printed before events started, nor a line dropped when the sink’s queue was briefly full. Reach for it to ask a question at a prompt, never to prove something did not happen.

§Bounded, like every other wait in this library

Each query is one crate::call::request_within with a short deadline: a CallDeadline, so a service that also SERVES clients can call these without a plain receive swallowing an unrelated request (CLAUDE.md 8.2). The sink holds its ring in memory, so a healthy answer is immediate and a slow one means the sink is in trouble - which is usually the reason you are asking.

Structs§

Status
How the event ring is doing.

Enums§

Outcome
How an exchange ENDED. One row per exchange, so this is its whole story.

Constants§

SINK
The service that holds the rings: "events".

Functions§

as_name
Declare the name this service publishes under.
events
The newest max IPC exchanges: seq, sec, caller, peer, op, outcome.
logs
The tail of what services printed: owner, text.
metric
Publish the current value of a named metric.
metrics
Every metric the sink currently holds: owner, metric, value, age_s.
status
Capacity, total recorded, and how many were dropped unread.