PoC for bespoke tracing#2033
Draft
huitseeker wants to merge 3 commits into0xMiden:mirko/tracingfrom
Draft
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This keeps Miden's tracing policy, but uses more of the Rust tracing ecosystem for the common parts:
tracing::instrument,tracing_error::ErrorLayer,tracing_panic::panic_hook,tracing_subscriber::reload,fmt::Layer, andstrum.Returned errors and panics are now span-level signals with useful context. Returned errors record the full error report on the span and avoid the duplicate exception event from native
#[instrument(err)]. Panics become span attributes plus span error status.Local stdout stays separate from OTel export. User-facing output is a tracing layer with explicit user span/event selection. Selected OTel-side user fields are bridged into
miden.user.fieldssofmt::Layercan print them.Runtime filter reload now uses
tracing_subscriber::reload. Target policy lives inmiden-node-tracing-targets, so the macro and runtime filters share one allowlist. Control-plane events still bypass user filters, but third-party targets stay blocked.Diff shape:
+1,320/-888, net+432+760/-60, net+700+2,080/-948, net+1,132New capabilities and their direct tests:
#[instrument(err)]span::tests::native_instrument_err_uses_top_level_error_and_emits_an_event,span::tests::instrument_macro_records_returned_errors,span::tests::instrument_macro_records_alias_returned_errors_with_err_markertracing-paniccontrol-plane eventsinternal::tests::control_plane_layer_records_panic_fields_on_current_span,internal::tests::control_plane_layer_bridges_panic_status_to_tracing_error_fieldinternal::tests::control_plane_layer_selects_panic_span_from_event_scope,internal::tests::control_plane_layer_records_panic_on_active_parent_when_child_span_is_disabled,internal::tests::control_plane_layer_skips_scope_child_filtered_from_exportersinternal::tests::control_plane_event_filter_rejects_tracing_panic_events,exporter::tests::plumbing_layers_do_not_enable_miden_callsites_when_exporters_are_offexporter::stdout::tests::fmt_layer_does_not_render_open_telemetry_span_attributes,exporter::stdout::tests::user_facing_span_data_can_be_rendered_by_fmt_layerexporter::stdout::tests::layer_logs_user_spans_and_events,exporter::stdout::tests::layer_ignores_non_user_spans_and_events,exporter::stdout::tests::layer_does_not_inherit_user_event_marker_from_spantracing_subscriber::reloadand keep filter readbackfilter::tests::dynamic_filter_tracks_current_value,filter::tests::dynamic_filter_set_enables_previously_disabled_callsites,filter::tests::tracing_subscriber_reload_enables_previously_disabled_callsites,exporter::tests::tracing_handle_exposes_filter_accessorstarget::tests::formats_allowed_targets_as_list,target::tests::parses_allowed_target_path,target::tests::rejects_unknown_target_path,filter::tests::dynamic_filter_rejects_third_party_targets,filter::tests::control_plane_target_bypasses_dynamic_filterAdditional coverage:
span::tests::instrument_macro_leaves_success_status_unsetspan::tests::span_records_fields_with_default_and_override_keys,span::tests::span_records_objects_with_default_and_override_prefixes,span::tests::span_records_user_fields_with_prefixed_keysinternal::tests::active_span_selection_ignores_third_party_current_span,internal::tests::active_span_layer_keeps_outer_enter_active_when_same_span_is_reenteredinternal::tests::active_span_future_tracks_span_only_during_poll,internal::tests::active_span_layer_tracks_public_entered_span,internal::tests::explicit_active_span_guard_does_not_pop_layer_tracked_spanfilter::tests::application_target_gate_still_applies_inside_span_filters,filter::tests::control_plane_filter_wrapper_preserves_span_filterstarget::tests::rejects_component_target,target::tests::rejects_target_string