|
1 | | -### runtime_tracing |
| 1 | +## runtime_tracing |
2 | 2 |
|
3 | | -trace type/helpers definitions |
| 3 | +A format and helper library for [CodeTracer](https://github.com/metacraft-labs/CodeTracer.git) traces |
| 4 | + |
| 5 | +### format |
| 6 | + |
| 7 | +A CodeTracer trace for its db backend consists of record data, metadata for the recorded program and copy of the relevant source/repository files. |
| 8 | +It's self contained, so one can debug a record of a version of a program from a different commit or branch. |
| 9 | +The record data consists of a stream of objects, each of which describes a certain program event: call, step, return etc. |
| 10 | + |
| 11 | +A trace contains several files: |
| 12 | +* trace.json : the record data |
| 13 | +* trace_metadata.json : metadata for the recorded program |
| 14 | +* trace_paths.json : a list of the recorded files |
| 15 | +* `files/`: a folder including all the source/repository files copied into the trace. |
| 16 | + |
| 17 | +The record data format is currently json which matches the record event rust types from `src/types.rs`. |
| 18 | + |
| 19 | +We plan on |
| 20 | +* defining a more precise document or a list of examples or a specification. |
| 21 | +* producing a more optimized next version of this format, probably based on a binary format. |
| 22 | + |
| 23 | +A future goal of this format is to make it possible to stream traces: to be able to replay them while they're still being recorded. |
| 24 | +This is one of the reasons for the decision to maintain a single "stream" of events currently. |
| 25 | + |
| 26 | +### tracer library |
| 27 | + |
| 28 | +We also define a Rust tracer library in `src/tracer.rs` which can be used as a helper to instrument Rust-based language interpreters and vm-s. |
| 29 | +It can make it easier to migrate to newer versions of the format, hiding many details behind its helpers. |
| 30 | +There are a few examples and tests of its usage in `src/lib.rs`. |
| 31 | + |
| 32 | +There are some actual usages of it as well which can be also used as an example: |
| 33 | +* in [blocksense-network/noir: their tracing support for CodeTracer](https://github.com/blocksense-network/noir/tree/blocksense/tooling/tracer) |
| 34 | +* in a small toy interpreter to be released as a part of the CodeTracer repo |
| 35 | + |
| 36 | +One can always directly produce the same traces from various languages. We're open for cooperation or discussion on usecases! |
| 37 | + |
| 38 | +### Legal |
4 | 39 |
|
5 | 40 | Authored and maintained by Metacraft Labs, Ltd |
6 | 41 |
|
|
0 commit comments