Repository navigation
feat: add a clippy CI cell and tag log records with an audience #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
68abcfd
feat(ci): add a clippy cell to the full matrix 💚
kp2pml30 0144861
feat(manager): carry log audience through the sink and evict introspe…
kp2pml30 759d128
feat(manager): tag log call sites with audience ✨
kp2pml30 04d7566
fix(manager): no provider could handle prompt is an operator log 🐛
kp2pml30 04ffa78
docs(impl-spec): describe the log record format and audience 📝
kp2pml30 f5675ca
docs(spec): fix references that name nothing 📝
kp2pml30 b4d7eb9
docs(spec): specify the runner count and path limits 📝
kp2pml30 594f500
fix(executor): account for ZIP runner metadata 🔒️
kp2pml30 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ Appendix | |
| host-loop | ||
| manager-api | ||
| manager-socket | ||
| log-record | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| Log Record Format | ||
| ================= | ||
|
|
||
| Every log line the executor and the manager emit is one JSON object. The same | ||
| shape is used on stderr, in the manager's own log and in the ``genvm_log`` | ||
| artifact served over the manager socket (see :doc:`manager-socket`). | ||
|
|
||
| Fields | ||
| ------ | ||
|
|
||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 16 14 70 | ||
|
|
||
| * - Key | ||
| - Type | ||
| - Meaning | ||
| * - ``level`` | ||
| - string | ||
| - One of ``trace``, ``debug``, ``info``, ``warn``, ``error``. Always the first key | ||
| * - ``audience`` | ||
| - string | ||
| - Who the record is meant for, see below. Always the second key | ||
| * - ``target`` | ||
| - string | ||
| - Rust module path of the call site | ||
| * - ``message`` | ||
| - string | ||
| - Human-readable text | ||
| * - ``ts`` | ||
| - string | ||
| - Wall-clock timestamp | ||
| * - *anything else* | ||
| - any | ||
| - Structured captures of the call site. Long strings and byte buffers are truncated | ||
| to a per-record byte limit, currently 128 bytes | ||
|
|
||
| ``audience`` is a reserved key: a capture named that way fails to compile and a | ||
| hand-built record carrying one has it dropped. | ||
|
|
||
| Audience | ||
| -------- | ||
|
|
||
| The audience is a tag only, it never takes part in filtering. It answers *who | ||
| should act on this line*: | ||
|
|
||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 18 82 | ||
|
|
||
| * - Value | ||
| - Reader | ||
| * - ``user`` | ||
| - The contract developer or caller: the record is a consequence of the contract's | ||
| own input, code or budget | ||
| * - ``operator`` | ||
| - The node runner: configuration, environment, providers, broken internal | ||
| invariants, panics | ||
| * - ``introspector`` | ||
| - Someone debugging GenVM itself: lifecycle tracing, state dumps, timings. The | ||
| default when a call site names none | ||
|
|
||
| Rules that follow from the tag: | ||
|
|
||
| 1. A ``user`` record may only carry scalar captures (display, error, debug, | ||
| id); bulk dumps such as calldata, byte buffers and serialised values are | ||
| rejected at compile time, and the byte limit is clamped to 128 regardless of | ||
| configuration | ||
| 2. Panics are ``operator`` | ||
| 3. Records from a v0.2.x executor, which knows nothing about audiences, are | ||
| tagged ``introspector`` by the manager | ||
| 4. A line the executor emitted that is not valid JSON is wrapped by the manager | ||
| into ``{"level": "error", "audience": "operator", "message": "genvm log", | ||
| "line": <base64>}`` | ||
|
|
||
| Lua scripts log through ``lib.log { level = ..., audience = ..., message = ... }``; | ||
| an absent or unknown ``audience`` means ``introspector``. | ||
|
|
||
| Manager Sink | ||
| ------------ | ||
|
|
||
| Under ``bounded`` capture (see :doc:`../01-core-architecture/04-executor`) the | ||
| manager keeps at most 128 records per execution and evicts by audience rather | ||
| than by age: | ||
|
|
||
| 1. While the cap has never been hit, everything is queued | ||
| 2. On the first overflow every ``introspector`` record is dropped, a marker | ||
| ``{"level": "warn", "audience": "operator", "message": "introspector logs dropped"}`` | ||
| is appended, and from then on ``introspector`` records are discarded on arrival | ||
| 3. On the next overflow the sink degrades to a plain queue that drops the oldest | ||
| ``user`` or ``operator`` record; ``introspector`` records stay discarded | ||
|
|
||
| The marker counts toward the cap. ``unbounded`` capture keeps every record. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.