{# ================= Fault-scoped block macros ================= #}
{% macro m_conclusion(c) %}
{% if c %}
{{ c.one_line_conclusion }}
{% if c.first_level_label or c.second_level_label %}
故障标签
{% if c.first_level_label %}{{ c.first_level_label }}{% endif %}
{% if c.second_level_label %}{{ c.second_level_label }}{% endif %}
{% endif %}
{% if c.fault_domain or c.fault_component %}
故障组件
{{ c.fault_component }}
影响范围
{% if c.affected_scope_pct %}{{ c.affected_scope_pct }}%{% else %}—{% endif %}
{% if c.affected_scope_desc %}
{{ c.affected_scope_desc }}
{% endif %}
置信度
{{ c.confidence or '—' }}
{% endif %}
{% if c.fault_function %}
故障函数
{{ c.fault_function }}
{% if c.fault_function_loc %}{{ c.fault_function_loc }}{% endif %}
{% endif %}
{% if c.key_findings %}
关键发现
{% for finding in c.key_findings %}- {{ finding }}
{% endfor %}
{% endif %}
{% endif %}
{% endmacro %}
{# ---- Latency block: metric strip + per-stage attribution (P99 / baseline / ratio / share) ---- #}
{% macro m_feature_value(value, unit='') -%}
{% if value is defined and value is not none %}{{ value }}{{ unit }}{% else %}—{% endif %}
{%- endmacro %}
{% macro m_feature_source(source) %}
来源:{{ source.endpoint }} · {{ source.response_path }} · 请求 {{ source.request | tojson }}
{% endmacro %}
{% macro m_feature_distribution(f, label) %}
| {{ label }} | {% for key in ['p50_ms','p90_ms','max_ms','client_p50_ms','client_p90_ms'] %}{{ m_feature_value(f.distribution[key], 'ms') }} | {% endfor %}
{% endmacro %}
{% macro m_latency_features(f) %}
阶段特征 · {{ f.operation }} / {{ f.bucket_key }}
{{ f.metric_name }} · 互斥归因桶
本桶 {{ f.trace_cnt }} 条(正常标记 {{ f.normal_cnt }} / 异常标记 {{ f.anomalous_cnt }});
占分类样本 {{ m_feature_value(f.bucket_share_pct, '%') }};桶内异常标记比例 {{ m_feature_value(f.anomalous_ratio_pct, '%') }};
P90/P50 {{ m_feature_value(f.tail_ratio_p90_p50, '×') }}。
分类样本 {{ f.sample_cnt }} 条 · {% if f.truncated %}已截断{% else %}未截断{% endif %};异常与慢正常请求混合选样,比例仅描述该样本。
| 窗口 | 证据 P50 | 证据 P90 | 证据最大值 | Client P50 | Client P90 |
{{ m_feature_distribution(f, '当前') }}{% if f.baseline %}{{ m_feature_distribution(f.baseline, '对照') }}{% endif %}
{% if f.baseline %}
相对对照窗口:证据 P90 差值 {{ m_feature_value(f.baseline.delta_p90_ms, 'ms') }};放大 {{ m_feature_value(f.baseline.p90_amplification, '×') }}。
对照桶 {{ f.baseline.trace_cnt }} / {{ f.baseline.sample_cnt }} 条 · {% if f.baseline.truncated %}已截断{% else %}未截断{% endif %}。仅比较同口径归因桶样本。
{{ m_feature_source(f.baseline.source) }}
{% endif %}
{% if f.windows %}
| 时间窗 | 本桶/分类样本 | 证据 P90 | 桶内异常标记比例 | 截断 |
{% for w in f.windows %}| {{ w.source.request.start_time }} → {{ w.source.request.end_time }} | {{ w.trace_cnt }} / {{ w.sample_cnt }} | {{ m_feature_value(w.distribution.p90_ms, 'ms') }} | {{ m_feature_value(w.anomalous_ratio_pct, '%') }} | {{ '是' if w.truncated else '否' }} |
{% endfor %}
{% for w in f.windows %}{{ m_feature_source(w.source) }}{% endfor %}
{% endif %}
{% if f.top_traces %}
桶内证据耗时 Top trace(代表阶段耗时极端请求;不代表严重度或全量分布)
| Trace ID | 证据/Client 耗时 | {% if f.trace_source %}Host / Pod IP | 源 → 目的 IP | 异常标记 / 错误码计数 | {% endif %}
{% for t in f.top_traces %}| {{ t.trace_id }} | {{ m_feature_value(t.evidence_ms, 'ms') }} / {{ m_feature_value(t.client_ms, 'ms') }} |
{% if f.trace_source %}{{ t.host or '—' }} / {{ t.pod_ips | join(', ') if t.pod_ips else '—' }} | {{ t.src_ip or '—' }} → {{ t.dst_ip or '—' }} | {% if t.is_anomalous is defined and t.is_anomalous is not none %}{{ '异常' if t.is_anomalous else '正常' }}{% else %}—{% endif %} / {% if t.failure_codes is defined and t.failure_codes is not none %}{% for c in t.failure_codes %}{{ c.code }} × {{ c.cnt }}{% if not loop.last %}, {% endif %}{% else %}无{% endfor %}{% else %}—{% endif %} | {% endif %}
{% endfor %}
{% endif %}
{% if f.trace_coverage %}
Top trace 补查返回 {{ f.trace_coverage.returned_cnt }}/{{ f.trace_coverage.requested_cnt }} 条{% if f.trace_coverage.missing_trace_ids %};未返回:{{ f.trace_coverage.missing_trace_ids | join(', ') }}{% endif %}。仅表示 Top trace 补查覆盖情况。
{% endif %}
{% if f.trace_source %}{{ m_feature_source(f.trace_source) }}{% endif %}
{% for text in [f.sample_note, f.note, f.action] %}{% if text %}
{{ text }}
{% endif %}{% endfor %}
{{ m_feature_source(f.source) }}
{% endmacro %}
{% macro m_latency(lat) %}
{% if lat %}
{% if lat.metrics %}
{% for m in lat.metrics %}
{{ m.label }}
{{ m.value }}
{% if m.sub %}
{{ m.sub }}
{% endif %}
{% endfor %}
{% endif %}
{% if lat.stages %}
阶段P99 时延基线放大耗时占比状态
{% for st in lat.stages %}
{{ st.name }}
{{ st.p99 or '—' }}
{% if st.baseline %}{{ st.baseline }}{% else %}—{% endif %}
{% if st.ratio %}{{ st.ratio }}{% else %}—{% endif %}
{% if st.share %}{{ st.share }}{% else %}—{% endif %}
{% if st.status == 'bottleneck' %}瓶颈{% elif st.status == 'warn' %}异常{% else %}正常{% endif %}
{% if st.detail %}{{ st.detail }}{% endif %}
{% if st.features %}{{ m_latency_features(st.features) }}{% endif %}
{% endfor %}
{% endif %}
{% if lat.conclusion %}
{{ lat.conclusion }}
{% endif %}
{% endif %}
{% endmacro %}
{% macro m_error_count(value, complete) -%}
{%- if value is none -%}—{%- elif not complete -%}≥{{ value }}{%- else -%}{{ value }}{%- endif -%}
{%- endmacro %}
{% macro m_error(err) %}
{% set palette = ['59,130,246', '239,68,68', '20,184,166', '168,85,247', '245,158,11', '14,165,233', '236,72,153', '132,204,22', '99,102,241', '249,115,22'] %}
{% if err.metrics %}
{% for m in err.metrics %}
{{ m.label }}
{{ m.value }}
{% if m.sub %}
{{ m.sub }}
{% endif %}
{% endfor %}
{% endif %}
{% for bd in err.breakdowns %}
{% set dist = bd.code_distribution %}{% set windows = bd.timeline.windows %}
{% set scale = namespace(max_count=1) %}
{% for w in windows %}{% for value in w.counts.values() %}{% if value is not none and value > scale.max_count %}{% set scale.max_count = value %}{% endif %}{% endfor %}
{% if w.other_count is not none and w.other_count > scale.max_count %}{% set scale.max_count = w.other_count %}{% endif %}{% endfor %}
{{ bd.operation }} · 错误码命中次数 {{ m_error_count(dist.total_count, bd.coverage.complete) }}
{{ bd.scope.start_time }} → {{ bd.scope.end_time }}(Asia/Shanghai,结束边界不包含)
{% for key in ['log_id', 'cluster_name', 'host', 'pod_ip', 'src_ip', 'dst_ip'] %}{% if bd.scope[key] %} · {{ key }}={{ bd.scope[key] }}{% endif %}{% endfor %}
{% if bd.code_filter %} · 本故障错误码筛选:{{ bd.code_filter | join(', ') }}{% endif %}
逐码命中计数:同一 trace 可命中多个错误码,不等于去重失败请求数或业务失败率;仅包含已识别故障模式的记录。
{% if not bd.coverage.complete %}
分页不完整:取得 {{ bd.coverage.returned_windows }} / {{ bd.coverage.total_windows }} 个有数据的原始桶。错误码按已取得计数排序;≥ 表示计数下界,— 表示未知;比例不展示。
{% endif %}
{% if dist['items'] %}
| 错误码 | 命中次数 | 占全部命中次数 | 构成 |
{% for item in dist['items'] %}
{{ item.code }} | {{ m_error_count(item.count, bd.coverage.complete) }} |
{% if item.share_pct is not none %}{{ '%.1f' | format(item.share_pct) }}%{% else %}—{% endif %} |
{% if item.share_pct is not none %}{% else %}—{% endif %} |
{% endfor %}
{% if dist.other_count %}| 其他错误码 | {{ m_error_count(dist.other_count, bd.coverage.complete) }} | {% if bd.coverage.complete and dist.total_count %}{{ '%.1f' | format(dist.other_count / dist.total_count * 100) }}%{% else %}—{% endif %} | {% if bd.coverage.complete and dist.total_count %}{% else %}—{% endif %} |
{% endif %}
{% else %}
已取得数据中没有符合筛选条件的错误码命中;此结果不能单独证明系统健康。
{% endif %}
错误码随时间分布 · 展示粒度 {{ bd.timeline.interval_seconds }} 秒;首尾窗口按查询边界截取。所有单元格按共同的最大计数着色,颜色越深计数越高;零为已知无命中,斜纹为未知。
| 时间窗(开始 → 结束) | {% for item in dist['items'] %}{{ item.code }} | {% endfor %}{% if dist.other_count %}其他错误码 | {% endif %}{% if not dist['items'] %}命中次数 | {% endif %}
{% for w in windows %}| {{ w.start_time }} → {{ w.end_time }} |
{% for item in dist['items'] %}{% set value = w.counts[item.code] %}
{{ m_error_count(value, w.complete) }} |
{% endfor %}
{% if dist.other_count or not dist['items'] %}{{ m_error_count(w.other_count, w.complete) }} | {% endif %}
{% endfor %}
统计来源与分页范围
{{ bd.source.endpoint }} · 原始有数据桶 {{ bd.coverage.returned_windows }}/{{ bd.coverage.total_windows }} · {% if bd.coverage.complete %}分页完整{% else %}分页不完整{% endif %}
{% for page in bd.source.pages %}{{ page.request | tojson }} → {{ page.response_path }}(本页 {{ page.returned_windows }} 桶)
{% endfor %}
{% endfor %}
{% if err.conclusion %}
{{ err.conclusion }}
{% endif %}
{% endmacro %}
{% macro m_solution(s) %}
{% if s.short_term %}
短期措施(立即执行)
{% for item in s.short_term %}
- {{ item }}
{% endfor %}
{% endif %}
{% if s.long_term %}
长期措施(预防复发)
{% for item in s.long_term %}
- {{ item }}
{% endfor %}
{% endif %}
{% if s.verification %}
验证方法
{% for item in s.verification %}
- {{ item }}
{% endfor %}
{% endif %}
{% endmacro %}
{% macro m_root_cause(rc) %}
{% for step in rc.reasoning_chain %}
{{ step.step_label }}: {{ step.title }}
{{ step.description }}
{% if step.evidence %}
{{ step.evidence }}
{% endif %}
{% endfor %}
{% if rc.confirmed_root_cause %}
确认根因:
{{ rc.confirmed_root_cause }}
{% if rc.supporting_knowledge %}
知识库支撑: {{ rc.supporting_knowledge }}
{% endif %}
{% endif %}
{% endmacro %}
{% macro m_evidence_traces(traces) %}
{% for t in traces %}
-
{{ t.trace_id }}
{% if t.kind == 'latency' %}时延{% else %}通断{% endif %}
{%- if t.evidence_ms is number %} · 证据 {{ t.evidence_ms }}ms{% endif %}
{%- if t.client_ms is number %} · 客户端 {{ t.client_ms }}ms{% endif %}
{%- if t.status_code %} · {{ t.status_code }}{% endif %}
{%- if t.pod %} · {{ t.pod }}{% endif %}
{%- if t.host %} · {{ t.host }}{% endif %}
{%- if t.timestamp %} · {{ t.timestamp }}{% endif %}
{{ t.why }}
{% endfor %}
{% endmacro %}
{% macro m_propagation(p) %}
{% set ns = namespace(order=0, bo=0) %}
{% for node in p.chain %}
{% set ns.order = ns.order + 1 %}
{{ ns.order }}
{{ node.label }}
{% if node.detail %}{{ node.detail }}{% endif %}
{% if node.tag %}{{ node.tag }}{% elif node.type == 'origin' %}故障源头{% elif node.type == 'impact' %}业务影响{% else %}传播环节{% endif %}
{% if node.branches %}
{% if node.transition %}{{ node.transition }}{% endif %}
{% for branch in node.branches %}
{% set b = branch if branch is mapping else {'nodes': branch} %}
{% if b.label %}
{{ b.label }}{% endif %}
{% for sub in b.nodes %}
{% set ns.bo = ns.bo + 1 %}
{{ ['a','b','c','d','e','f','g','h'][ns.bo - 1] }}
{{ sub.label }}
{% if sub.detail %}{{ sub.detail }}{% endif %}
{% if sub.tag %}{{ sub.tag }}{% elif sub.type == 'origin' %}故障源头{% elif sub.type == 'impact' %}业务影响{% else %}传播环节{% endif %}
{% if not loop.last %}
{% if sub.transition %}{{ sub.transition }}{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% elif not loop.last %}
{% if node.transition %}{{ node.transition }}{% endif %}
{% endif %}
{% endfor %}
{% if p.impact_scope %}
影响范围:
{% for scope in p.impact_scope %}
{{ scope }}{% if not loop.last %};{% endif %}
{% endfor %}
{% endif %}
{% endmacro %}
{% macro m_knowledge(matches, fid) %}
{% if matches %}
{% for match in matches %}
匹配逻辑{{ match.match_logic }}
现象{{ match.symptom }}
原因{{ match.root_cause }}
{% if match.solution %}
方案{{ match.solution }}
{% endif %}
{% if match.phenomenon_fit or match.log_fit or match.rc_consistency or match.env_diff or match.adaptation %}
{% if match.phenomenon_fit %}
现象契合{{ match.phenomenon_fit }}
{% endif %}
{% if match.log_fit %}
日志/栈契合{{ match.log_fit }}
{% endif %}
{% if match.rc_consistency %}
根因一致{{ match.rc_consistency }}
{% endif %}
{% if match.env_diff %}
环境/版本差异{{ match.env_diff }}
{% endif %}
{% if match.adaptation %}
适配修改{{ match.adaptation }}
{% endif %}
{% endif %}
{% if match.applicability %}
{% if match.applicability == 'direct' %}可直接采用{% elif match.applicability == 'adjust' %}调整后采用{% elif match.applicability == 'reference' %}仅供参考{% elif match.applicability == 'not_recommended' %}不建议采用{% else %}{{ match.applicability }}{% endif %}
{% elif match.adoption_label %}
{{ match.adoption_label }}
{% endif %}
{% endfor %}
{% else %}
无匹配的知识库条目。
{% endif %}
{% endmacro %}
{% macro m_source(sc) %}
{% if sc %}
{% if sc.call_chain %}
{% for node in sc.call_chain %}
{%- set nxt = sc.call_chain[loop.index] if not loop.last else none -%}
{%- set cs_str = node.call_site if node.call_site else '' -%}
{%- set cs_num = (cs_str.split(':')[-1] | int) if ((':' in cs_str) and (cs_str.split(':')[-1] | int)) else 0 -%}
{%- set cs_hit = (node.code | selectattr('num', 'equalto', cs_num) | first) if cs_num else none -%}
{{ loop.index }}
{{ node.function }}
{{ node.file }}{% if node.line %}:{{ node.line }}{% endif %}
{% if node.role_label %}{{ node.role_label }}{% endif %}
{% if node.code %}
源码片段{% if node.line %} · {{ node.file }}:{{ node.line }}{% endif %}
{%- for line in node.code -%}
{% if line.ellipsis %}{{ line.text }}{% else %}{% if line.highlight %}{% endif %}{{ line.num }}{{ line.text }}{% if line.highlight %}{% endif %}{% endif %}
{%- endfor -%}
{% endif %}
{% if not loop.last %}
调用点{% if cs_str %} · {{ cs_str }}{% endif %} → {{ nxt.function }}
{%- if cs_hit -%}
{{ cs_hit.num }}{{ cs_hit.text }}
{%- else -%}
?// 调用 {{ nxt.function }}{{ ' @ ' ~ cs_str if cs_str }}
{%- endif -%}
{% endif %}
{% if node.analysis %}
{% if node.role == 'fault-point' %}故障点分析{% else %}描述{% endif %}
{{ node.analysis }}
{% endif %}
{% endfor %}
{% if sc.root_cause or sc.fix_suggestion %}
{% if sc.root_cause %}
{% endif %}
{% if sc.fix_suggestion %}
修复建议
{{ sc.fix_suggestion }}
{% endif %}
{% endif %}
{% else %}
{% if sc.code_snippet %}
{%- for line in sc.code_snippet -%}
{% if line.ellipsis %}{{ line.text }}{% else %}{% if line.highlight %}{% endif %}{{ line.num }}{{ line.text }}{% if line.highlight %}{% endif %}{% endif %}
{%- endfor -%}
{% endif %}
{% if sc.analysis %}
{% for para in sc.analysis %}
{{ para }}
{% endfor %}
{% endif %}
{% if sc.root_cause or sc.fix_suggestion %}
{% if sc.root_cause %}
{% endif %}
{% if sc.fix_suggestion %}
修复建议
{{ sc.fix_suggestion }}
{% endif %}
{% endif %}
{% endif %}
{% else %}
未获取到相关源码。可能原因:组件源码未拉取,或故障模式未关联源码文件。
{% endif %}
{% endmacro %}
{# ---- Donut chart macro: pure CSS conic-gradient pie, auto-completes remainder as "其他" ---- #}
{% macro donut_chart(items, total='', total_label='') -%}
{%- set palette = ['#4f7cff', '#37c7b5', '#8fb0ff', '#F59E0B', '#E5484D', '#8B5CF6', '#0EA5E9', '#EC4899'] -%}
{%- set gray = '#C3CBD4' -%}
{%- set ns = namespace(grad='', start=0.0) -%}
{%- for item in items -%}
{%- set end = ns.start + (item.pct | float) -%}
{%- set ns.grad = ns.grad ~ palette[loop.index0 % (palette | length)] ~ ' ' ~ (ns.start | round(2)) ~ '% ' ~ (end | round(2)) ~ '%' -%}
{%- if not loop.last %}{%- set ns.grad = ns.grad ~ ', ' -%}{% endif -%}
{%- set ns.start = end -%}
{%- endfor -%}
{%- set remainder = (100 - ns.start) | round(2) -%}
{%- if remainder > 0.5 -%}{%- set ns.grad = ns.grad ~ ', ' ~ gray ~ ' ' ~ (ns.start | round(2)) ~ '% 100%' -%}{%- endif -%}
{% if total %}
{{ total }}
{{ total_label }}
{% endif %}
{% for item in items %}
-
{% if item.code %}{{ item.code }} {{ item.name }}{% elif item.domain %}{{ item.domain }}{% elif item.pod %}{{ item.pod }}{% if item.host %} @{{ item.host }}{% endif %}{% elif item.host %}{{ item.host }}{% endif %}
{% if item.fault %}{{ item.fault }}{% endif %}
{{ item.pct }}%
{% endfor %}
{% if remainder > 0.5 %}
- 其他{{ remainder }}%
{% endif %}
{%- endmacro %}
知识库
{{ basic_info.kb_name }}
KB ID
{{ basic_info.kb_id }}
日志文件
{{ basic_info.log_file }}
操作类型
{{ basic_info.operation }}
时间范围
{{ basic_info.time_range_start }} ~ {{ basic_info.time_range_end }}
总 Trace 数
{{ basic_info.total_trace_cnt }}
故障 Trace
{{ basic_info.fault_trace_cnt }} ({{ basic_info.fault_ratio }}%)
任务状态
{% if basic_info.parse_ok %}
解析完成
{% else %}
解析异常
{% endif %}
{% if basic_info.diagnosis_ok %}
诊断完成
{% else %}
诊断未完成
{% endif %}
{{ inc.one_line_conclusion }}
{% if is_multi %}
识别故障
{{ inc.fault_count }} 个
主故障 1 · 次生 {{ inc.secondary_fault_count }} · 独立 {{ inc.independent_fault_count }}
主故障
{{ inc.primary_fault_id }}
{{ pns.p.title }}
总体影响范围
{{ inc.overall_impact or '—' }}
综合置信度
{{ inc.confidence or '—' }}
{% else %}
故障域
{{ f0.conclusion.fault_domain }}
故障组件
{{ f0.conclusion.fault_component }}
影响范围
{{ f0.conclusion.affected_scope_pct }}%
{{ f0.conclusion.affected_scope_desc }}
置信度
{{ f0.conclusion.confidence }}
{% if f0.conclusion.fault_function %}
故障函数
{{ f0.conclusion.fault_function }}
{% if f0.conclusion.fault_function_loc %}{{ f0.conclusion.fault_function_loc }}{% endif %}
{% endif %}
{% if f0.conclusion.key_findings %}
关键发现
{% for finding in f0.conclusion.key_findings %}- {{ finding }}
{% endfor %}
{% endif %}
{% endif %}
{% if is_multi %}
| 编号 | 故障名称 | 角色 | 确认状态 | 严重级别 | 影响范围 | 置信度 |
{% for f in fault_list %}
| {{ f.id }} |
{{ f.title }} |
{% if f.role == 'primary' %}主故障{% elif f.role == 'secondary' %}次生故障{% else %}独立故障{% endif %} |
{% if f.status == 'confirmed' %}已确认{% elif f.status == 'suspected' %}疑似{% elif f.status == 'excluded' %}已排除{% else %}{{ f.status }}{% endif %} |
{% if f.severity %}{{ f.severity }}{% else %}—{% endif %} |
{{ f.affected_scope or '—' }} |
{% if f.confidence is number %}{{ f.confidence }}%{% else %}{{ f.confidence or '—' }}{% endif %} |
{% endfor %}
{% if rels %}
故障关系
{% for r in rels %}
{{ r.from }}
{% if r.type == 'causes' %}导致{% elif r.type == 'common_cause' %}同根因{% elif r.type == 'independent' %}相互独立{% elif r.type == 'correlated' %}时间相关{% else %}{{ r.type }}{% endif %}
{% if r.confidence is number %}置信 {{ (r.confidence * 100) | round | int }}%{% else %}置信 {{ r.confidence }}{% endif %}
▶
{{ r.to }}
{{ r.evidence }}
{% endfor %}
因果(A 导致 B)
同根因
相互独立
仅时间相关(不作为因果)
{% endif %}
{% endif %}
{% if acts %}
| 优先级 | 关联故障 | 处置操作 | 前置依赖 | 预期效果 | 验证标准 |
{% for a in acts %}
| {{ a.priority }} |
{% for fid in a.fault_ids %}{% set fr = namespace(role='independent') %}{% for ff in fault_list %}{% if ff.id == fid %}{% set fr.role = ff.role %}{% endif %}{% endfor %}{{ fid }} {% endfor %} |
{{ a.action }} |
{{ a.depends_on or '—' }} |
{{ a.expected_effect or '—' }} |
{{ a.verify or '—' }} |
{% endfor %}
{% endif %}
{% set sbs = statistics.stage_breakdowns if statistics.stage_breakdowns else ([statistics.stage_breakdown] if statistics.stage_breakdown else []) %}
{% for sb in sbs %}
阶段分解(按请求流程阶段) — 操作: {{ sb.operation }} · 总时延 P99: {{ sb.total_p99_ms }}
{% if sb.share_bar %}
{% for seg in sb.share_bar %}
{% if seg.pct | float > 8 %}{{ seg.pct }}%{% endif %}
{% endfor %}
{% for seg in sb.share_bar %}
{{ seg.name }} {{ seg.pct }}%
{% endfor %}
{% endif %}
阶段P99 时延时延异常率失败占比状态
{% for st in sb.stages %}
{% set st_role = (fault_list | selectattr('id', 'equalto', st.fault) | map(attribute='role') | first) or 'independent' %}
{{ st.name }}{% if st.fault %} {{ st.fault }}{% endif %}
{{ st.p99 }}
{{ st.anomaly_rate }}
{% if st.fail_share %}
{{ st.fail_share }}{% else %}
—{% endif %}
{% if st.status == 'bottleneck' %}瓶颈{% elif st.status == 'warn' %}异常{% else %}正常{% endif %}
{% if st.detail %}
{{ st.detail }}{% endif %}
{% endfor %}
{% if sb.conclusion %}
{{ sb.conclusion }}
{% endif %}
{% endfor %}
{% if statistics.top_error_codes or statistics.top_failure_domains or statistics.top_pods or statistics.top_hosts %}
{% if statistics.top_error_codes %}
错误码分布 (Top 5)
{{ donut_chart(statistics.top_error_codes, statistics.dist_total or '', '故障 Trace') }}
{% endif %}
{% if statistics.top_failure_domains %}
故障域分布
{{ donut_chart(statistics.top_failure_domains, statistics.dist_total or '', '故障 Trace') }}
{% endif %}
{% if statistics.top_pods %}
故障 Pod 分布 (Top 5)
{{ donut_chart(statistics.top_pods, statistics.dist_total or '', '故障 Trace') }}
{% endif %}
{% if statistics.top_hosts %}
故障 Host 分布 (Top 5)
{{ donut_chart(statistics.top_hosts, statistics.dist_total or '', '故障 Trace') }}
{% endif %}
{% endif %}
{% if statistics.time_heatmap %}
时间热点分布{% if statistics.heatmap_metric == 'latency' %} — 各时段 P99 时延{% endif %}
{% for slot in statistics.time_heatmap %}
{% if slot.spike %}
尖峰{% else %}
尖峰{% endif %}
{% if slot.lat_ms %}{{ slot.lat_ms }}ms{% else %}{{ slot.pct }}%{% endif %}
{{ slot.time }}
{% endfor %}
无故障
低
中
高
尖峰/爆发
{% endif %}
{% for f in fault_list %}
{% if f.role == 'secondary' %}
{% endif %}
{% if f.status == 'suspected' %}
本故障为候选假设,根因尚未确认,下列结论与证据仅供参考,不能直接认定。
{% endif %}
{% if f.conclusion %}
故障结论
{{ m_conclusion(f.conclusion) }}{% endif %}
{% if f.error and not f.simplified %}
通断故障分布
{{ m_error(f.error) }}{% endif %}
{% if f.latency %}
时延阶段定位
{{ m_latency(f.latency) }}{% endif %}
{% if not f.simplified %}
{% if f.root_cause %}
根因推理链
{{ m_root_cause(f.root_cause) }}{% endif %}
{% if f.evidence_traces %}
证据锚点
{{ m_evidence_traces(f.evidence_traces) }}{% endif %}
{% if f.propagation %}
故障传播链
{{ m_propagation(f.propagation) }}{% endif %}
{% if f.knowledge_matches %}
知识库匹配
{{ m_knowledge(f.knowledge_matches, f.id) }}{% endif %}
{% if f.solution %}
解决方案
{{ m_solution(f.solution) }}{% endif %}
{% if f.source_code %}
源码分析
{{ m_source(f.source_code) }}{% endif %}
{% elif f.solution and f.need_independent_fix %}
解决方案
{{ m_solution(f.solution) }}
{% endif %}
{% endfor %}
{{ workflow.session_id }}
Session
{{ workflow.total_steps }}
Steps
{{ workflow.api_calls }}
API Calls
{{ workflow.duration }}
耗时
{% for step in workflow.steps %}
{{ step.title }}
{% if step.api_calls %}
{% for call in step.api_calls %}
→ {{ call }}
{% endfor %}
{% endif %}
{% if step.result %}
{{ step.result }}
{% endif %}
{% endfor %}