Pipeline.Tracing.NestedExecution (pipeline v0.0.1)
View SourceExecution tracing and monitoring for nested pipeline execution.
Provides comprehensive tracing capabilities including span tracking, execution trees, performance metrics, and debugging information for nested pipeline workflows.
Summary
Functions
Generate an execution tree from trace spans.
Complete a span in the trace.
Create debug information for troubleshooting.
Generate performance summary from execution tree.
Start tracing a nested pipeline execution.
Generate a visual representation of the execution tree.
Types
@type execution_span() :: %{ id: span_id(), trace_id: trace_id(), parent_span: span_id() | nil, pipeline_id: String.t(), step_name: String.t() | nil, step_type: String.t() | nil, depth: non_neg_integer(), start_time: DateTime.t(), end_time: DateTime.t() | nil, duration_ms: non_neg_integer() | nil, status: :running | :completed | :failed, error: String.t() | nil, metadata: map() }
@type execution_tree() :: %{ pipeline_id: String.t(), spans: [execution_span()], children: [execution_tree()], total_duration_ms: non_neg_integer(), step_count: non_neg_integer(), max_depth: non_neg_integer() }
@type span_id() :: String.t()
@type trace_context() :: %{ trace_id: trace_id(), current_span: span_id() | nil, spans: %{required(span_id()) => execution_span()}, start_time: DateTime.t() }
@type trace_id() :: String.t()
Functions
@spec build_execution_tree(trace_context()) :: execution_tree()
Generate an execution tree from trace spans.
Parameters
trace_context
: Trace context containing all spans
Returns
- Hierarchical execution tree
@spec complete_span(trace_context(), any()) :: trace_context()
Complete a span in the trace.
Parameters
trace_context
: Current trace contextresult
: Execution result (:ok, {:ok, value}, or {:error, reason})
Returns
- Updated trace context
@spec create_debug_info(trace_context(), any()) :: map()
Create debug information for troubleshooting.
Parameters
trace_context
: Current trace contexterror
: Error that occurred (optional)
Returns
- Debug information map
@spec generate_performance_summary(execution_tree()) :: map()
Generate performance summary from execution tree.
Parameters
execution_tree
: The execution tree to analyze
Returns
- Performance summary with metrics by depth
@spec start_nested_trace(String.t(), map(), map() | nil, trace_context() | nil) :: trace_context()
Start tracing a nested pipeline execution.
Parameters
pipeline_id
: The ID of the pipeline being executedcontext
: Current execution contextstep
: Current step configuration (optional)parent_trace
: Parent trace context (optional)
Returns
- New trace context with initial span
@spec visualize_execution_tree(execution_tree(), map()) :: String.t()
Generate a visual representation of the execution tree.
Parameters
execution_tree
: The execution tree to visualizeoptions
: Visualization options (optional)
Returns
- String representation of the execution tree