[{"data":1,"prerenderedAt":282},["ShallowReactive",2],{"content-/blog/monitoring-system":3,"related-blog":257},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"keywords":10,"author":11,"date":12,"category":13,"image":14,"body":15,"_type":251,"_id":252,"_source":253,"_file":254,"_stem":255,"_extension":256},"/blog/monitoring-system","blog",false,"","监控系统建设","构建完善的监控告警系统，保障系统稳定运行","监控系统建设, Blog, HTMLPAGE","HTMLPAGE","2025-11-26","待分类","/content-images/blog/blog.jpg",{"type":16,"children":17,"toc":238},"root",[18,26,33,53,59,72,78,91,97,105,110,115,121,155,160,173,178,191,196,204,208,213,235],{"type":19,"tag":20,"props":21,"children":22},"element","p",{},[23],{"type":24,"value":25},"text","构建可观测的监控系统是保障线上服务可用性和性能的基础。本文从指标选取、数据采集、告警与追踪四个方面说明如何从零构建或改进监控体系。",{"type":19,"tag":27,"props":28,"children":30},"h3",{"id":29},"核心指标what-to-measure",[31],{"type":24,"value":32},"核心指标（What to measure）",{"type":19,"tag":34,"props":35,"children":36},"ul",{},[37,43,48],{"type":19,"tag":38,"props":39,"children":40},"li",{},[41],{"type":24,"value":42},"可用性：服务可达性、错误率（4xx/5xx）。",{"type":19,"tag":38,"props":44,"children":45},{},[46],{"type":24,"value":47},"性能：请求延迟（p50/p95/p99）、页面关键性能指标（FCP、LCP、TTI）。",{"type":19,"tag":38,"props":49,"children":50},{},[51],{"type":24,"value":52},"资源：CPU、内存、连接数与队列深度。",{"type":19,"tag":27,"props":54,"children":56},{"id":55},"数据采集how-to-collect",[57],{"type":24,"value":58},"数据采集（How to collect）",{"type":19,"tag":34,"props":60,"children":61},{},[62,67],{"type":19,"tag":38,"props":63,"children":64},{},[65],{"type":24,"value":66},"后端：结构化日志、指标库（Prometheus）与分布式追踪（OpenTelemetry）。",{"type":19,"tag":38,"props":68,"children":69},{},[70],{"type":24,"value":71},"前端：RUM（Real User Monitoring）收集真实用户的关键体验指标，并将其与后端 trace 关联。",{"type":19,"tag":27,"props":73,"children":75},{"id":74},"告警与响应alerting",[76],{"type":24,"value":77},"告警与响应（Alerting）",{"type":19,"tag":34,"props":79,"children":80},{},[81,86],{"type":19,"tag":38,"props":82,"children":83},{},[84],{"type":24,"value":85},"基于业务影响设计告警阈值（错误率、延迟、用户受影响数），避免告警泛滥。",{"type":19,"tag":38,"props":87,"children":88},{},[89],{"type":24,"value":90},"告警响应流程需集成 Runbook，指明排查路径与临时缓解措施。",{"type":19,"tag":27,"props":92,"children":94},{"id":93},"trace-与根因分析",[95],{"type":24,"value":96},"Trace 与根因分析",{"type":19,"tag":34,"props":98,"children":99},{},[100],{"type":19,"tag":38,"props":101,"children":102},{},[103],{"type":24,"value":104},"集成分布式追踪，能在跨服务调用中快速定位瓶颈与错误源。将 trace id 贯穿到日志与请求上下文中，缩短定位时间。",{"type":19,"tag":27,"props":106,"children":108},{"id":107},"实践建议",[109],{"type":24,"value":107},{"type":19,"tag":20,"props":111,"children":112},{},[113],{"type":24,"value":114},"监控系统用于实时观察生成平台的运行状况与性能趋势，是发现性能回归与定位问题的首要工具。本文概述指标、日志与追踪（三位一体）的设计与实践。",{"type":19,"tag":116,"props":117,"children":119},"h2",{"id":118},"核心观测面",[120],{"type":24,"value":118},{"type":19,"tag":34,"props":122,"children":123},{},[124,135,145],{"type":19,"tag":38,"props":125,"children":126},{},[127,133],{"type":19,"tag":128,"props":129,"children":130},"strong",{},[131],{"type":24,"value":132},"指标（Metrics）",{"type":24,"value":134},"：CPU/内存、请求延迟分位（P50/P95/P99）、队列深度与任务吞吐。",{"type":19,"tag":38,"props":136,"children":137},{},[138,143],{"type":19,"tag":128,"props":139,"children":140},{},[141],{"type":24,"value":142},"日志（Logs）",{"type":24,"value":144},"：按照结构化 JSON 打点业务事件与错误上下文，便于聚合与搜索。",{"type":19,"tag":38,"props":146,"children":147},{},[148,153],{"type":19,"tag":128,"props":149,"children":150},{},[151],{"type":24,"value":152},"分布式追踪（Tracing）",{"type":24,"value":154},"：跟踪跨服务请求链路（trace id），定位延迟来源与依赖耗时。",{"type":19,"tag":116,"props":156,"children":158},{"id":157},"指标聚合与告警",[159],{"type":24,"value":157},{"type":19,"tag":34,"props":161,"children":162},{},[163,168],{"type":19,"tag":38,"props":164,"children":165},{},[166],{"type":24,"value":167},"为关键 SLA 指标设定阈值并在 CI 中记录基线；使用 Prometheus/Grafana 做可视化与长期趋势分析。",{"type":19,"tag":38,"props":169,"children":170},{},[171],{"type":24,"value":172},"告警策略应结合抑制与分级，避免告警风暴并确保重要问题及时上报。",{"type":19,"tag":116,"props":174,"children":176},{"id":175},"可观测性实践",[177],{"type":24,"value":175},{"type":19,"tag":34,"props":179,"children":180},{},[181,186],{"type":19,"tag":38,"props":182,"children":183},{},[184],{"type":24,"value":185},"在生成管线中打点关键阶段（入队、开始处理、外部调用、完成），并记录上下文（模板 id、用户 id、task id）。",{"type":19,"tag":38,"props":187,"children":188},{},[189],{"type":24,"value":190},"对慢请求采样完整追踪日志以节省存储并提高诊断效率。",{"type":19,"tag":116,"props":192,"children":194},{"id":193},"运行时诊断工具",[195],{"type":24,"value":193},{"type":19,"tag":34,"props":197,"children":198},{},[199],{"type":19,"tag":38,"props":200,"children":201},{},[202],{"type":24,"value":203},"提供快速的回放/回溯工具（replay）以在本地或预生产复现问题场景。",{"type":19,"tag":205,"props":206,"children":207},"hr",{},[],{"type":19,"tag":20,"props":209,"children":210},{},[211],{"type":24,"value":212},"相关链接：",{"type":19,"tag":34,"props":214,"children":215},{},[216,226],{"type":19,"tag":38,"props":217,"children":218},{},[219],{"type":19,"tag":220,"props":221,"children":223},"a",{"href":222},"/blog",[224],{"type":24,"value":225},"返回博客分类",{"type":19,"tag":38,"props":227,"children":228},{},[229],{"type":19,"tag":220,"props":230,"children":232},{"href":231},"/blog/topic/multi-agent-system",[233],{"type":24,"value":234},"查看热门话题",{"type":19,"tag":205,"props":236,"children":237},{},[],{"title":7,"searchDepth":239,"depth":239,"links":240},3,[241,242,243,244,245,246,248,249,250],{"id":29,"depth":239,"text":32},{"id":55,"depth":239,"text":58},{"id":74,"depth":239,"text":77},{"id":93,"depth":239,"text":96},{"id":107,"depth":239,"text":107},{"id":118,"depth":247,"text":118},2,{"id":157,"depth":247,"text":157},{"id":175,"depth":247,"text":175},{"id":193,"depth":247,"text":193},"markdown","content:blog:monitoring-system.md","content","blog/monitoring-system.md","blog/monitoring-system","md",[258,266,274],{"_path":259,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":260,"description":261,"keywords":262,"author":11,"date":12,"category":13,"image":14,"_type":251,"_id":263,"_source":253,"_file":264,"_stem":265,"_extension":256},"/blog/2025-q1-updates","2025 Q1 产品更新","第一季度重大功能发布：AI 生成优化、新模板上线、编辑器增强等","2025 Q1 产品更新, Blog, HTMLPAGE","content:blog:2025-q1-updates.md","blog/2025-q1-updates.md","blog/2025-q1-updates",{"_path":267,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":268,"description":269,"keywords":270,"author":11,"date":12,"category":13,"image":14,"_type":251,"_id":271,"_source":253,"_file":272,"_stem":273,"_extension":256},"/blog/2025-roadmap","2025 产品路线图","展望 2025 年的产品规划：AI 能力增强、模板扩充、国际化等","2025 产品路线图, Blog, HTMLPAGE","content:blog:2025-roadmap.md","blog/2025-roadmap.md","blog/2025-roadmap",{"_path":275,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":276,"description":277,"keywords":278,"author":11,"date":12,"category":13,"image":14,"_type":251,"_id":279,"_source":253,"_file":280,"_stem":281,"_extension":256},"/blog/ab-testing","A/B 测试","通过 A/B 测试验证设计方案","A/B 测试, Blog, HTMLPAGE","content:blog:ab-testing.md","blog/ab-testing.md","blog/ab-testing",1774945285769]