Flow Analysis
Flow Analysis
Section titled “Flow Analysis”Overview
Section titled “Overview”flow_analysis measures dependency-flow shape across three layers:
- Structural flow from the import graph
- Logical flow from git co-change patterns
- Runtime flow from telemetry-mapped call edges
The metric emits keys under flow_analysis.* and uses a domain-based v2 schema (2.0.0).
Key Groups
Section titled “Key Groups”Structural graph (flow_analysis.graph.*)
Section titled “Structural graph (flow_analysis.graph.*)”flow_analysis.graph.node_countflow_analysis.graph.edge_countflow_analysis.graph.total_weightflow_analysis.graph.densityflow_analysis.graph.avg_out_weightflow_analysis.graph.max_fan_in_weightflow_analysis.graph.max_fan_out_weightflow_analysis.graph.gini_fan_inflow_analysis.graph.gini_fan_outflow_analysis.graph.flow_hierarchyflow_analysis.graph.cycle_edge_ratioflow_analysis.graph.global_reaching_centrality
Bow-tie decomposition (flow_analysis.bow_tie.*)
Section titled “Bow-tie decomposition (flow_analysis.bow_tie.*)”flow_analysis.bow_tie.gscc_ratioflow_analysis.bow_tie.in_ratioflow_analysis.bow_tie.out_ratioflow_analysis.bow_tie.tendril_ratioflow_analysis.bow_tie.disconnected_ratio
Bottlenecks (flow_analysis.bottleneck.*)
Section titled “Bottlenecks (flow_analysis.bottleneck.*)”flow_analysis.bottleneck.edge_betweenness_maxflow_analysis.bottleneck.edge_betweenness_avgflow_analysis.bottleneck.high_edge_countflow_analysis.bottleneck.edge_betweenness_approxflow_analysis.bottleneck.edge_betweenness_skippedflow_analysis.bottleneck.top_edgesflow_analysis.bottleneck.edges_table
Logical overlay (flow_analysis.logical.*)
Section titled “Logical overlay (flow_analysis.logical.*)”flow_analysis.logical.availableflow_analysis.logical.edge_countflow_analysis.logical.total_weightflow_analysis.logical.densityflow_analysis.logical.jaccard_with_staticflow_analysis.logical.logical_only_ratioflow_analysis.logical.static_only_ratioflow_analysis.logical.mismatch_scoreflow_analysis.logical.top_hidden_edgesflow_analysis.logical.edges_table
Runtime overlay (flow_analysis.runtime.*)
Section titled “Runtime overlay (flow_analysis.runtime.*)”flow_analysis.runtime.availableflow_analysis.runtime.edge_countflow_analysis.runtime.total_traffic_weightflow_analysis.runtime.avg_edge_latency_msflow_analysis.runtime.error_edge_ratioflow_analysis.runtime.jaccard_with_staticflow_analysis.runtime.runtime_only_ratioflow_analysis.runtime.static_unobserved_ratioflow_analysis.runtime.traffic_top1_ratioflow_analysis.runtime.mismatch_scoreflow_analysis.runtime.top_hot_edgesflow_analysis.runtime.edges_table
Shared tables and timings
Section titled “Shared tables and timings”flow_analysis.module_tableflow_analysis.phase.structural_msflow_analysis.phase.bottleneck_msflow_analysis.phase.logical_msflow_analysis.phase.runtime_ms
Core Formulas
Section titled “Core Formulas”flow_analysis.graph.density = edge_count / (node_count * (node_count - 1))for directed graphs.flow_analysis.graph.flow_hierarchy = 1 - flow_analysis.graph.cycle_edge_ratio.flow_analysis.logical.mismatch_score = (logical_only_ratio + static_only_ratio + (1 - jaccard_with_static)) / 3.flow_analysis.runtime.mismatch_score = (runtime_only_ratio + static_unobserved_ratio + (1 - jaccard_with_static)) / 3.
Profiles and Availability
Section titled “Profiles and Availability”profile: static- Logical and runtime overlays are disabled (
flow_analysis.logical.available = 0,flow_analysis.runtime.available = 0).
- Logical and runtime overlays are disabled (
profile: balanced- Logical overlay is enabled.
- Runtime overlay is enabled only when telemetry traces are present.
profile: full- Runtime overlay is attempted every run.
- If runtime prerequisites are missing, runtime keys still exist but
flow_analysis.runtime.available = 0.
Notes:
- Logical overlay can be enabled but empty (for example, no usable co-change edges).
- Runtime overlay requires mapped runtime data; when mapping is unavailable, runtime values stay at defaults with
available = 0.
Configuration Defaults
Section titled “Configuration Defaults”metrics: - id: flow_analysis enabled: true config: profile: balanced group_by_folder_depth: null cochange_threshold: 2 edge_betweenness_max_sources: 256 edge_betweenness_skip_above_nodes: 20000 high_edge_betweenness_threshold: 0.15 runtime_min_traffic_weight: 0.01 density_threshold_small: 0.18 density_threshold_medium: 0.10 density_threshold_large: 0.04 density_threshold_xlarge: 0.015 emit_phase_timings: trueFindings
Section titled “Findings”flow_analysis emits deterministic findings with these rule_id values:
flow_analysis.high_densityflow_analysis.low_hierarchyflow_analysis.edge_bottleneckflow_analysis.logical_hidden_couplingflow_analysis.runtime_hot_pathflow_analysis.runtime_error_path
Policy Examples
Section titled “Policy Examples”policy: invariants: - metric: flow_analysis.graph.density op: "<=" value: 0.20 - metric: flow_analysis.graph.flow_hierarchy op: ">=" value: 0.80 - metric: flow_analysis.logical.mismatch_score op: "<=" value: 0.35 - metric: flow_analysis.runtime.traffic_top1_ratio op: "<=" value: 0.35Breaking Migration (v1 -> v2)
Section titled “Breaking Migration (v1 -> v2)”| v1 key | v2 key |
|---|---|
flow_analysis.nodes | flow_analysis.graph.node_count |
flow_analysis.links | flow_analysis.graph.edge_count |
flow_analysis.total_flow | flow_analysis.graph.total_weight |
flow_analysis.avg_degree | flow_analysis.graph.avg_out_weight |
flow_analysis.max_fan_in | flow_analysis.graph.max_fan_in_weight |
flow_analysis.max_fan_out | flow_analysis.graph.max_fan_out_weight |
flow_analysis.gini_fan_in | flow_analysis.graph.gini_fan_in |
flow_analysis.gini_fan_out | flow_analysis.graph.gini_fan_out |
flow_analysis.density | flow_analysis.graph.density |
flow_analysis.top_fan_in | flow_analysis.module_table (fan-in columns) |
flow_analysis.top_fan_out | flow_analysis.module_table (fan-out columns) |
flow_analysis.nodes_table | flow_analysis.module_table |