← 中文资源

简体中文版本

指标基数审计

调优可观测性:审计指标基数,配置链路采样,并确认日志结构化且在预算内保留,避免成本失控。

阅读英文原文

概述

调优可观测性:审计指标基数,配置链路采样,并确认日志结构化且在预算内保留,避免成本失控。本工作流属于可观测性领域,目标是keep observability signal high while controlling cost and cardinality within the configured budget.以下步骤将指导你完成关键操作,并在每一步设置可验证的中间状态,确保最终结果可复现、可审计、可回滚。

步骤详解

  1. Audit metric cardinality。 Inspect the top series by label and identify high-cardinality labels that should be removed or bucketed.预期状态:Series count drops after removing or bucketing the offending labels.

  2. Configure trace sampling。 Set tail sampling to keep all error traces and a representative sample of healthy traces within the volume budget.预期状态:Error traces are retained and healthy-trace volume stays within budget.

  3. Verify structured logs。 Confirm every service emits JSON logs with a correlation id and the retention policy matches the compliance window.预期状态:Logs are structured, correlated, and retained for the required window.

每一步都包含明确的动作与预期状态。执行时请记录实际输出,与预期状态逐一对照。若某一步未达预期,应停下排查而非继续推进,避免问题向后传递放大。

验证与后续

验证方法:keep observability signal high while controlling cost and cardinality within the configured budget.完成后,将本次执行的命令、输出与参数归档,并更新团队运行手册。若用于生产环境,请先在预发环境完整演练一次,并确认团队熟悉回滚路径与应急联系人。本工作流难度级别为高级(advanced),预计耗时约35分钟。该流程已通过结构化校验,步骤与决策点均与英文版本严格一致,可在本地按工作流步骤复现并核对结果。

代码示例

promtool check rules rules/*.yaml