|
1 | 1 | <!doctype html> |
2 | 2 | <html lang="en"><head> |
3 | 3 | <meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /> |
4 | | -<title>void-box events and observability</title><link rel="stylesheet" href="../../assets/css/site.css" /> |
| 4 | +<title>Events + Observability | Void-Box</title><link rel="stylesheet" href="../../assets/css/site.css" /> |
5 | 5 | <!-- Google tag (gtag.js) --> |
6 | 6 | <script async src="https://www.googletagmanager.com/gtag/js?id=G-YRRVNN7VM4"></script> |
7 | 7 | <script> |
|
12 | 12 | gtag('config', 'G-YRRVNN7VM4'); |
13 | 13 | </script> |
14 | 14 | </head><body> |
15 | | -<header class="site"><div class="wrap inner"><a class="brand" href="../../"><img src="../../assets/img/void-box.png" alt="void-box logo" /><span>Void-Box</span></a><nav class="top"><a href="../">Docs</a><a href="../architecture/">Architecture</a><a href="../cli-tui/">CLI/TUI</a><a class="star-btn" href="https://github.com/the-void-ia/void-box" target="_blank" rel="noreferrer">★ Star</a></nav></div></header> |
| 15 | +<header class="site"><div class="wrap inner"><a class="brand" href="../../"><img src="../../assets/img/void-box.png" alt="void-box logo" /><span>Void-Box</span></a> |
| 16 | +<nav class="top"> |
| 17 | + <a href="../">Docs</a> |
| 18 | + <a href="../../guides/">Guides</a> |
| 19 | + <a href="https://github.com/the-void-ia/void-box" target="_blank" rel="noreferrer">GitHub</a> |
| 20 | + <a class="star-btn" href="https://github.com/the-void-ia/void-box" target="_blank" rel="noreferrer">★ Star</a> |
| 21 | +</nav> |
| 22 | +</div></header> |
| 23 | + |
16 | 24 | <main class="doc-main wrap"> |
| 25 | + <div class="doc-layout"> |
| 26 | + <aside class="doc-sidebar"> |
| 27 | + <nav> |
| 28 | + <strong>Docs</strong> |
| 29 | + <a href="../architecture/">Architecture</a> |
| 30 | + <a href="../runtime/">Runtime Model</a> |
| 31 | + <a href="../cli-tui/">CLI + TUI</a> |
| 32 | + <a class="active" href="../events-observability/">Events + Observability</a> |
| 33 | + <a href="../oci-containers/">OCI Containers</a> |
| 34 | + <a href="../snapshots/">Snapshots</a> |
| 35 | + <a href="../host-mounts/">Host Mounts</a> |
| 36 | + <a href="../security/">Security</a> |
| 37 | + <a href="../wire-protocol/">Wire Protocol</a> |
| 38 | + </nav> |
| 39 | + </aside> |
| 40 | + <div class="doc-content"> |
| 41 | + |
17 | 42 | <section> |
18 | 43 | <div class="kicker">Events + Observability</div> |
19 | 44 | <h1>Run Event Model</h1> |
20 | | -<p>VoidBox events are designed to keep capability and boundary context explicit for every action.</p> |
21 | | -<div class="card"><h3>Identity fields</h3><p><code>run_id</code>, <code>box_name</code>, <code>skill_id</code>, <code>environment_id</code>, <code>mode</code>, <code>stream</code>, <code>seq</code>.</p></div> |
| 45 | +<p>Every pipeline run in VoidBox is fully instrumented. The event system provides structured identity fields on every action, OTLP-compatible traces and metrics, and structured logs -- all designed to keep capability and boundary context explicit.</p> |
| 46 | +</section> |
| 47 | + |
| 48 | +<section> |
| 49 | +<h2>Identity Fields</h2> |
| 50 | +<article class="card"> |
| 51 | + <h3>Every event carries these fields</h3> |
| 52 | + <p><code>run_id</code> -- unique identifier for the pipeline run.<br> |
| 53 | + <code>box_name</code> -- the VoidBox that emitted the event.<br> |
| 54 | + <code>skill_id</code> -- which skill is active.<br> |
| 55 | + <code>environment_id</code> -- the execution environment (VM) identifier.<br> |
| 56 | + <code>mode</code> -- execution mode (single, pipeline, workflow).<br> |
| 57 | + <code>stream</code> -- output stream (stdout, stderr).<br> |
| 58 | + <code>seq</code> -- monotonic sequence number for ordering.</p> |
| 59 | +</article> |
22 | 60 | </section> |
| 61 | + |
23 | 62 | <section> |
24 | 63 | <h2>Core Event Types</h2> |
25 | | -<ul> |
26 | | - <li><code>run.started</code>, <code>run.finished</code>, <code>run.failed</code>, <code>run.cancelled</code></li> |
27 | | - <li><code>env.provisioned</code></li> |
28 | | - <li><code>skill.mounted</code></li> |
29 | | - <li><code>box.started</code>, <code>workflow.planned</code></li> |
30 | | - <li><code>log.chunk</code>, <code>log.closed</code></li> |
31 | | -</ul> |
| 64 | +<table> |
| 65 | + <thead> |
| 66 | + <tr><th>Event</th><th>Description</th></tr> |
| 67 | + </thead> |
| 68 | + <tbody> |
| 69 | + <tr><td><code>run.started</code></td><td>Pipeline run has begun execution.</td></tr> |
| 70 | + <tr><td><code>run.finished</code></td><td>Pipeline run completed successfully.</td></tr> |
| 71 | + <tr><td><code>run.failed</code></td><td>Pipeline run failed with an error.</td></tr> |
| 72 | + <tr><td><code>run.cancelled</code></td><td>Pipeline run was cancelled by the user.</td></tr> |
| 73 | + <tr><td><code>env.provisioned</code></td><td>Guest environment has been provisioned (skills, config, mounts).</td></tr> |
| 74 | + <tr><td><code>skill.mounted</code></td><td>A skill has been written to the guest filesystem.</td></tr> |
| 75 | + <tr><td><code>box.started</code></td><td>A VoidBox has started execution within a stage.</td></tr> |
| 76 | + <tr><td><code>workflow.planned</code></td><td>A workflow planner has generated a pipeline plan.</td></tr> |
| 77 | + <tr><td><code>log.chunk</code></td><td>A chunk of streaming output from the guest (stdout/stderr).</td></tr> |
| 78 | + <tr><td><code>log.closed</code></td><td>The output stream for a box has closed.</td></tr> |
| 79 | + </tbody> |
| 80 | +</table> |
| 81 | +</section> |
| 82 | + |
| 83 | +<section> |
| 84 | +<h2>Trace Structure</h2> |
| 85 | +<p>VoidBox emits OpenTelemetry-compatible traces that capture the full execution hierarchy:</p> |
| 86 | +<pre><code>Pipeline span |
| 87 | + └─ Stage 1 span (box_name="data_analyst") |
| 88 | + ├─ tool_call event: Read("input.json") |
| 89 | + ├─ tool_call event: Bash("curl ...") |
| 90 | + └─ attributes: tokens_in, tokens_out, cost_usd, model |
| 91 | + └─ Stage 2 span (box_name="quant_analyst") |
| 92 | + └─ ...</code></pre> |
| 93 | +<p>Each stage span includes attributes for token counts, cost, model used, and individual tool call events. Fan-out stages create parallel child spans under the same pipeline parent.</p> |
| 94 | +<img src="../../assets/img/void-box-tracing-5.png" alt="VoidBox tracing visualization" style="max-width:100%;margin:1.5rem 0;" /> |
| 95 | +</section> |
| 96 | + |
| 97 | +<section> |
| 98 | +<h2>Instrumentation</h2> |
| 99 | +<div class="grid-2"> |
| 100 | + <article class="card"> |
| 101 | + <h3>OTLP Traces</h3> |
| 102 | + <p>Full distributed traces exported via OTLP gRPC. Pipeline, stage, and tool-call spans with rich attributes for token usage, cost, model, and timing.</p> |
| 103 | + </article> |
| 104 | + <article class="card"> |
| 105 | + <h3>Metrics</h3> |
| 106 | + <p>Token counts (input/output), cost in USD, execution duration, and VM lifecycle timing. Exported as OTLP metrics alongside traces.</p> |
| 107 | + </article> |
| 108 | + <article class="card"> |
| 109 | + <h3>Structured Logs</h3> |
| 110 | + <p>All log output is prefixed with <code>[vm:NAME]</code> for easy filtering. Stream-json output from claude-code is parsed into structured events.</p> |
| 111 | + </article> |
| 112 | + <article class="card"> |
| 113 | + <h3>Guest Telemetry</h3> |
| 114 | + <p>The guest-agent reads <code>/proc/stat</code> and <code>/proc/meminfo</code> periodically, sending <code>TelemetryBatch</code> messages over vsock. The host-side <code>TelemetryAggregator</code> ingests these and exports as OTLP metrics.</p> |
| 115 | + </article> |
| 116 | +</div> |
| 117 | +</section> |
| 118 | + |
| 119 | +<section> |
| 120 | +<h2>Configuration</h2> |
| 121 | +<table> |
| 122 | + <thead> |
| 123 | + <tr><th>Env var</th><th>Description</th></tr> |
| 124 | + </thead> |
| 125 | + <tbody> |
| 126 | + <tr><td><code>VOIDBOX_OTLP_ENDPOINT</code></td><td>OTLP gRPC endpoint (e.g. <code>http://localhost:4317</code>)</td></tr> |
| 127 | + <tr><td><code>OTEL_SERVICE_NAME</code></td><td>Service name for traces (default: <code>void-box</code>)</td></tr> |
| 128 | + </tbody> |
| 129 | +</table> |
| 130 | +<p>OpenTelemetry support is enabled at compile time:</p> |
| 131 | +<pre><code>cargo build --features opentelemetry</code></pre> |
| 132 | +<p>For a full OTLP setup walkthrough with Jaeger or Grafana, see the <a href="../../guides/observability-setup/">Observability Setup guide</a>.</p> |
32 | 133 | </section> |
| 134 | + |
| 135 | +<section> |
| 136 | +<h2>Guest Telemetry Pipeline</h2> |
| 137 | +<p>The guest-side telemetry pipeline works independently from the host tracing system:</p> |
| 138 | +<ol> |
| 139 | + <li>The guest-agent periodically reads <code>/proc/stat</code> (CPU usage) and <code>/proc/meminfo</code> (memory usage).</li> |
| 140 | + <li>Readings are batched into a <code>TelemetryBatch</code> message and sent to the host over the vsock channel.</li> |
| 141 | + <li>The host-side <code>TelemetryAggregator</code> receives batches, computes deltas, and exports them as OTLP metrics.</li> |
| 142 | +</ol> |
| 143 | +<p>This gives visibility into guest resource consumption without any instrumentation inside the workload itself.</p> |
| 144 | +</section> |
| 145 | + |
33 | 146 | <section> |
34 | 147 | <h2>Persistence Providers</h2> |
35 | | -<p>Daemon run/session state uses a provider abstraction: <code>disk</code> (default), plus example adapters for <code>sqlite</code> and <code>valkey</code>.</p> |
| 148 | +<p>Daemon run and session state uses a provider abstraction, allowing different storage backends:</p> |
| 149 | +<div class="grid-2"> |
| 150 | + <article class="card"> |
| 151 | + <h3>Disk (default)</h3> |
| 152 | + <p>File-based persistence. Run state and events are stored as JSON files on the local filesystem. No external dependencies.</p> |
| 153 | + </article> |
| 154 | + <article class="card"> |
| 155 | + <h3>SQLite / Valkey</h3> |
| 156 | + <p>Adapter implementations for <code>sqlite</code> and <code>valkey</code> (Redis-compatible) backends. Useful for shared state in multi-node deployments.</p> |
| 157 | + </article> |
| 158 | +</div> |
36 | 159 | </section> |
| 160 | + |
| 161 | + </div> |
| 162 | + </div> |
37 | 163 | </main> |
38 | 164 | <footer><div class="wrap"><a href="../">← Docs</a></div></footer> |
39 | 165 | <script src="../../assets/js/site.js"></script> |
|
0 commit comments