feat: improve observability#638
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a new amaru-observability subsystem (proc‑macros, runtime registry, schemas), migrates many crates to schema-backed tracing (#[trace], trace_span!, trace_record!), updates CI and toolchain to validate/generate TRACES.md, and bumps trace payload shapes and tests. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Macro as ProcMacro (amaru-observability-macros)
participant Registry as Schema Registry (inventory)
participant Generated as Generated Wrapper
participant Runtime as App / tracing_subscriber
Dev->>Macro: annotate fn with #[trace(path, ...)]
Macro->>Registry: resolve schema path & metadata
alt invalid schema
Registry-->>Macro: not found / validation error
Macro-->>Dev: emit compile_error!
else valid schema
Macro->>Generated: emit validators + RECORD/INSTRUMENT wrappers
Generated-->>Dev: expanded instrumented function
Dev->>Runtime: run instrumented function
Runtime->>Runtime: create span, record fields (on_record)
Runtime->>Runtime: close span -> emit final JSON
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
6b73bb4 to
2cd8cbb
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
6f53d10 to
82b9e38
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
0400516 to
0ab23e5
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
0ab23e5 to
7a379ea
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
f675eef to
7dd9197
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
7dd9197 to
670031a
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
2e16788 to
32b4a49
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
76d3bbd to
5b6aa83
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
This reverts commit 8a3f286. Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
ab6cb0b to
bb3d5a0
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
…low to disable tracing code generation via AMARU_TRACE_NOOP env var Signed-off-by: jeluard <jeluard@users.noreply.github.com>
0811282 to
1fd727f
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
…ault trace level Signed-off-by: jeluard <jeluard@users.noreply.github.com>
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
etorreborre
left a comment
There was a problem hiding this comment.
This is a very nice feature to standardize our traces! We should not wait too much to merge it because there are going to be some merge conflicts and it will be good to have this kind of support when the consensus stages are being reworked.
Maybe the biggest thing that could be missing is the ability to annotate a span as "internal" so that it can still be used but not part of the external API.
|
|
||
| | name | level | description | required fields | optional fields | | ||
| | --- | --- | --- | --- | --- | | ||
| | `decode_header` | `TRACE` | Decode header from raw bytes | | | |
There was a problem hiding this comment.
I'm just leaving this as a note.
I think that we need to use the levels a bit better and not leave everything at the TRACE level.
For example, for the amaru::consensus::chain_sync target, the decode_header span should probably be at the DEBUG level, pull at the TRACE level (this is a low-level mechanism) and maybe select_chain at the INFO level.
This way we can use the INFO level to see high-level normal processing, and other levels to drill-down.
The important thing IMO is to have the ability to drill-down target by target, and for example see the possible interactions between the ledger and the consensus by selecting amaru_ledger=debug, amaru_consensus=info.
There was a problem hiding this comment.
I generally agree although I feel like it mostly apply to human logs, not computer traces.
For computer traces we probably want everything (and filtering some actually breaks parent/child relationships). At least for OTEL.
Now we also have an issue of too many logs generated for now. Especially when the node catches up and apply lots of blocks.
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
8feb7dc to
2912574
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
2912574 to
4777881
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
24fe2c3 to
6ab4f02
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
b878215 to
c22303d
Compare
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
General cleanup/improvements of the observability stack. For more context about those changes please refer to this document.
amaru-observabilityschemasconcept alongsidetraceandaugment-tracemacros (seeschemas.rs)docs/TRACES.mddocumentation is automatically generated and checked by CIdocs/traces-schema.jsonJSON Schema is automatically generated and checked by CIDefining
AMARU_TRACE_NOOPallows to disable all trace generations, and removes all associated code generation.Syntax
(from the EDR)
This PR leverages significantly complex macros to generate meaningful
compile-timeerrors. It received some AI love in the process.Fixes #640
Summary by CodeRabbit
New Features
Documentation
Tests
Chores