Skip to content

Create a miden-node-tracing crate #1406

@Mirko-von-Leipzig

Description

@Mirko-von-Leipzig

tracing and open telemetry are a bit tricky to consistently use correctly. This is due to several reasons, but often its that the defaults are wrong for how we want things to be.

As an example, #[tracing::instrument(err)] doesn't let us print an error report and one needs to remember to do this manually at the root level.

What also happens is that we sometimes use fields restricted by open telemetry e.g. error and this then gets overridden in the open telemetry exporter.


What I would like to experiment with is to create a new miden-node-tracing crate which then exposes fixed or improved versions of the tracing macros, as well as some common utilities. This would then become the only crate allowed to depend on tracing and related crates.

This restriction could of course happen in stages.


#[instrument] improvements

  • skip_all by default
  • err should use our custom report format instead of display
  • make name auto-inherit similar to target
    • maybe we can add a macro to the module which name = <mod>.<function>
  • maybe remove manual span building to force correct async compatibility

Name by type trait

It's also a pita to keep the field names aligned. We have tx.id, transaction.id etc.

If we add a trait which provides a const name for each type then the macro can use this to standardize this.

Types which implement this trait can be passed in as fields "naked" without a field name, and the macro will use the trait const as the name. This can be overriden by specifying a name (this would be the same as the current tracing macros).


... wip

Metadata

Metadata

Assignees

Labels

telemetryRelates to tracing and open-telemetry
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions