[metrics]
metrics
Where a deployment's numbers go, and how many of them one core keeps.
Novis counts what it does — requests served, time and memory spent, failures reported — and this block says who collects those counts. The exporter is off unless something is written; otherwise it names a scrape endpoint the engine answers at the address beside it, or a collector it pushes to instead. One more key bounds how many distinct series a single core will hold, so a label built out of something a visitor sent cannot grow the registry without end.
The whole block is the operator's. A program able to switch the exporter off, or to point it somewhere else, could stop being measured at the moment being measured matters most.
A value naming no protocol is refused when the configuration file is read, because what it produces otherwise is silence — and a collector nothing ever writes to looks exactly like a deployment with nothing to say.
The example prints what this checkout exports and asks for each of the keys in turn.
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.
Who collects this deployments numbers
<?nvs// `[metrics]` sets where Novis sends the numbers it counts about itself. It also// sets `max_series`, the most different series one CPU core keeps.
// This file does not write `[metrics]`. The exporter is `false`, so nothing is exported.// The series cap is the default, `10000`.echo 'exporter: ', Core\Config::get('metrics.exporter') ?? '(no value)', "\n";echo 'scrape at: ', Core\Config::get('metrics.listen') ?? '(nothing written)', "\n";echo 'push to: ', Core\Config::get('metrics.endpoint') ?? '(nothing written)', "\n";echo 'series cap: ', Core\Config::get('metrics.max_series') ?? '(no value)', "\n";
// Only the person who runs the server may change `[metrics]`.
// `Core\Config::set('metrics.exporter', ...)` does not compile,// because a program may not change `metrics.exporter`.
// This program keeps the names in variables. The compiler does not check a variable, so each `set` call runs and returns `false`.string $exporter = 'metrics.exporter';string $endpoint = 'metrics.endpoint';string $maxSeries = 'metrics.max_series';echo 'switch it off: ', Core\Config::set($exporter, 'false') ? 'accepted' : 'not allowed', "\n";echo 'push somewhere else: ', Core\Config::set($endpoint, 'https://collector.mine/v1') ? 'accepted' : 'not allowed', "\n";echo 'raise the series cap: ', Core\Config::set($maxSeries, '100000000') ? 'accepted' : 'not allowed', "\n";
// `[trace]` works the same way. A program cannot turn off its own tracing,// so this call returns `false` too.string $traceExporter = 'trace.exporter';echo 'traces go to: ', Core\Config::get('trace.exporter') ?? '(no value)', "\n";echo 'stop tracing me: ', Core\Config::set($traceExporter, 'false') ? 'accepted' : 'not allowed', "\n";exporter: falsescrape at: (nothing written)push to: (nothing written)series cap: 10000switch it off: not allowedpush somewhere else: not allowedraise the series cap: not allowedtraces go to: falsestop tracing me: 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. |
