Raxol.Core.Performance.AIIntegration (Raxol v2.0.1)

View Source

AI integration module for performance analysis.

This module provides the interface for integrating with AI services to enhance performance analysis and provide intelligent recommendations. It bridges the gap between performance metrics and AI-powered insights.

Summary

Functions

Analyzes performance metrics (AI features disabled - returns basic analysis).

Generates contextual help content for performance issues.

Generates a comprehensive performance report with AI insights.

Provides real-time performance optimization suggestions.

Predicts performance issues based on current metrics and trends.

Types

ai_service()

@type ai_service() :: :openai | :anthropic | :local | :mock

analysis_depth()

@type analysis_depth() :: :basic | :detailed | :comprehensive

optimization_level()

@type optimization_level() :: :minimal | :balanced | :aggressive

Functions

analyze_performance(metrics, options \\ %{})

Analyzes performance metrics (AI features disabled - returns basic analysis).

Parameters

  • metrics: Map containing performance metrics from the monitor
  • options: Map of analysis options
    • :service (atom) - AI service to use (currently disabled)
    • :depth (atom) - Analysis depth (currently disabled)
    • :focus (list) - Areas to focus on ([:fps, :memory, :jank, :gc])
    • :historical_data (list) - Optional historical metrics for trend analysis
    • :optimization_level (atom) - Level of optimization suggestions

Returns

  • Map containing:
    • :insights - AI-generated performance insights
    • :recommendations - Prioritized optimization suggestions
    • :risk_assessment - Performance risk analysis
    • :optimization_impact - Expected impact of suggested optimizations
    • :ai_confidence - AI's confidence in the analysis
    • :code_suggestions - Specific code optimization examples

generate_performance_help(issue_type, context \\ %{})

Generates contextual help content for performance issues.

Parameters

  • issue_type: Type of performance issue (:slow_rendering, :memory_leak, etc.)
  • context: Additional context about the issue

Returns

  • Generated help content with explanations and solutions

generate_report(metrics, options \\ %{})

Generates a comprehensive performance report with AI insights.

Parameters

  • metrics: Map containing performance metrics
  • options: Map of report options
    • :format (atom) - Report format (:text, :json, :html, :markdown)
    • :include_graphs (boolean) - Whether to include performance graphs
    • :include_code_samples (boolean) - Whether to include code optimization examples
    • :ai_service (atom) - AI service to use for analysis

Returns

  • Map containing the formatted report and additional data

get_optimization_suggestions(component_name, context, options \\ %{})

Provides real-time performance optimization suggestions.

Parameters

  • component_name: Name of the component being analyzed
  • context: Map containing component context and metrics
  • options: Map of optimization options

Returns

  • List of optimization suggestions with priority and impact

predict_performance_issues(metrics, historical_data \\ [], options \\ %{})

Predicts performance issues based on current metrics and trends.

Parameters

  • metrics: Current performance metrics
  • historical_data: Historical metrics for trend analysis
  • options: Prediction options

Returns

  • Map containing predicted issues and confidence levels