Pipeline.Metrics.NestedPerformance (pipeline v0.0.1)
View SourcePerformance metrics collection and analysis for nested pipeline execution.
Provides detailed performance tracking, metrics aggregation, and performance analysis capabilities for nested pipeline workflows.
Summary
Functions
Analyze performance metrics and identify issues.
Compare performance between multiple executions.
Complete performance tracking and generate final metrics.
Emit telemetry events for performance metrics.
Generate a performance report.
Record metrics for a single pipeline execution.
Start performance tracking for a nested pipeline execution.
Types
@type depth_metric() :: %{ depth: non_neg_integer(), pipeline_count: non_neg_integer(), total_duration_ms: non_neg_integer(), avg_duration_ms: float(), min_duration_ms: non_neg_integer(), max_duration_ms: non_neg_integer(), success_rate: float(), step_count: non_neg_integer() }
@type performance_metrics() :: %{ execution_id: String.t(), trace_id: String.t(), start_time: DateTime.t(), end_time: DateTime.t() | nil, total_duration_ms: non_neg_integer() | nil, pipeline_metrics: [pipeline_metric()], depth_metrics: %{required(non_neg_integer()) => depth_metric()}, resource_metrics: resource_metric(), summary: performance_summary() }
@type performance_summary() :: %{ total_pipelines: non_neg_integer(), total_steps: non_neg_integer(), max_depth: non_neg_integer(), overall_success_rate: float(), performance_grade: atom(), bottlenecks: [String.t()], recommendations: [String.t()] }
@type pipeline_metric() :: %{ pipeline_id: String.t(), depth: non_neg_integer(), duration_ms: non_neg_integer() | nil, step_count: non_neg_integer(), success: boolean(), error: String.t() | nil, memory_usage_mb: float() | nil, child_pipelines: [String.t()] }
@type resource_metric() :: %{ peak_memory_mb: float(), avg_memory_mb: float(), total_memory_allocated_mb: float(), gc_collections: non_neg_integer(), process_count_peak: non_neg_integer() }
Functions
@spec analyze_performance(performance_metrics()) :: map()
Analyze performance metrics and identify issues.
Parameters
performance_metrics
: Completed performance metrics
Returns
- Performance analysis with insights and recommendations
@spec compare_performance([performance_metrics()], map()) :: String.t()
Compare performance between multiple executions.
Parameters
performance_metrics_list
: List of performance metrics to compareoptions
: Comparison options
Returns
- Performance comparison report
@spec complete_performance_tracking(performance_metrics()) :: performance_metrics()
Complete performance tracking and generate final metrics.
Parameters
performance_context
: Current performance tracking context
Returns
- Completed performance metrics with analysis
@spec emit_performance_telemetry(performance_metrics(), atom()) :: :ok
Emit telemetry events for performance metrics.
Parameters
performance_metrics
: Performance metrics to emitevent_type
: Type of telemetry event
@spec generate_performance_report(performance_metrics(), map()) :: String.t()
Generate a performance report.
Parameters
performance_metrics
: Performance metrics to report onoptions
: Report generation options
Returns
- Formatted performance report
@spec record_pipeline_metric( performance_metrics(), String.t(), non_neg_integer(), non_neg_integer(), non_neg_integer(), boolean(), String.t() | nil, map() ) :: performance_metrics()
Record metrics for a single pipeline execution.
Parameters
performance_context
: Current performance tracking contextpipeline_id
: Pipeline that was executeddepth
: Nesting depth of the pipelineduration_ms
: Execution duration in millisecondsstep_count
: Number of steps in the pipelinesuccess
: Whether execution was successfulerror
: Error message if execution failedmetadata
: Additional metadata
Returns
- Updated performance context
@spec start_performance_tracking(String.t(), String.t()) :: performance_metrics()
Start performance tracking for a nested pipeline execution.
Parameters
trace_id
: The trace ID for this executionpipeline_id
: The root pipeline ID
Returns
- Performance tracking context