[trace]
trace
Whether this deployment records what a request did, and how much of it.
A trace is the story of one request across every process that handled it. This block says where those spans are shipped, what fraction of the requests this process starts are recorded, and whether a call it makes outbound carries the trace it belongs to, so the service on the other end can add its own part of the story.
In plain words: the exporter says who is told, and the sample says how often. Writing only the first one gets you a collector nothing arrives at, because the fraction starts at none.
The whole block is the operator's. A program that could raise its own sample would be selecting the requests worth recording, and one that could lower it would be choosing not to be looked at — which is exactly the kind of decision a trace exists to make visible. A developer who wants a trace of their own request has Core\Debug, and nothing here affects it.
The example prints what this checkout records and is turned away trying to change each of the three things about it that matter.
Only nvs.toml sets this key. A request may not change it.
A change in the file takes effect a few seconds after you save it. The server does not restart.
How much of what happens here is recorded
<?nvs// `[trace]` sets where request traces are sent and what share of requests is// traced. It also sets whether an outgoing call sends the trace header.
// This file does not write `[trace]`. So the exporter is `false`, `sample` is `0.0`// and `propagate` is `true`. These are the defaults.echo 'exporter: ', Core\Config::get('trace.exporter') ?? '(no value)', "\n";echo 'push to: ', Core\Config::get('trace.endpoint') ?? '(nothing written)', "\n";echo 'sample: ', Core\Config::get('trace.sample') ?? '(no value)', "\n";echo 'propagate: ', Core\Config::get('trace.propagate') ?? '(no value)', "\n";
// `exporter` and `sample` are separate settings. `sample` starts at `0`, so you// must set both before any trace is sent.
// Only the person who runs the server may change `[trace]`, so `Core\Config::set('trace.sample', ...)`// does not compile. Here the names are in variables, so each call runs and returns `false`.string $sample = 'trace.sample';string $propagate = 'trace.propagate';
// A program cannot trace more of its own requests, so this call returns `false`.echo 'record every request of mine: ', Core\Config::set($sample, '1.0') ? 'accepted' : 'not allowed', "\n";
// A program cannot trace fewer of its requests either. This call also returns `false`.echo 'record none of them: ', Core\Config::set($sample, '0.0') ? 'accepted' : 'not allowed', "\n";
// A program cannot stop sending the trace header on outgoing calls. This call// returns `false` too.echo 'leave the trace behind: ', Core\Config::set($propagate, 'false') ? 'accepted' : 'not allowed', "\n";exporter: falsepush to: (nothing written)sample: 0.0propagate: truerecord every request of mine: not allowedrecord none of them: not allowedleave the trace behind: not allowedChangelog
| Version | Change |
|---|---|
0.0.6 | The page of each setting says whether a request may change it with Core\Config::set. A page for a block lists the settings in it that a request may change. |
