DOP-C02 免费试练题 · 考证匠讲解
题目
A company has a mobile application that makes HTTP API calls to an Application Load Balancer (ALB). The ALB routes requests to an AWS Lambda function. Many different versions of the application are in use at any given time, including versions that are in testing by a subset of users. The version of the application is defined in the user-agent header that is sent with all requests to the API. After a series of recent changes to the API, the company has observed issues with the application. The company needs to gather a metric for each API operation by response code for each version of the application that is in use. A DevOps engineer has modified the Lambda function to extract the API operation name, version information from the user-agent header and response code. Which additional set of actions should the DevOps engineer take to gather the required metrics?
答案
拆题
- 需要按 API 操作、响应码、客户端版本观察数量,日志要包含这三个结构化字段。
- Metric filter 从日志事件产生指标;Logs Insights 是查询工具,不能仅写一个查询就自动形成指标流水线。
- 维度组合影响时间序列数量与成本,版本应标准化,不能把完整 user-agent 或用户 ID 当维度。
每个选项为什么对、为什么错
- A(正确):Lambda 写结构化日志,过滤器按字段形成带版本和响应码维度的计数,直接符合要求。
- B:Insights 能聚合分析历史日志,但普通查询不会自动持续写 CloudWatch 自定义指标。
- C:ALB 访问日志通常写 S3,且不会凭任意 Lambda 响应元数据自动提供自定义版本字段,链路假设错误。
- D:X-Ray 用于请求追踪,Insights 不会自动按任意 subsegment 字段生成题中这种全量业务计数。
放到具体场景里
教学例子:日志为 {"operation":"checkout","version":"2.4","status":500},为该组合计数加一。把 2.4 与 2.3 的 checkout 500 次数及总请求量分别比较,可发现新版本错误率升高。只看 500 次数不够,因为版本流量可能不同。
| 检查对象 | 本例条件或动作 | 结果与边界 |
|---|---|---|
| 日志字段 | operation / version / status | 结构化且稳定 |
| 指标值 | 每事件加 1 | 形成计数 |
| 比较 | 500 次数 ÷ 总请求数 | 避免流量差异误判 |
遇到同类题的判断顺序
- 提取字段:标准化客户端版本与操作。
- 写入日志:输出可解析 JSON。
- 生成指标:过滤器创建限定维度计数。
- 比较版本:使用相同操作的错误率分析。
参考资料
继续练这门考试
同一门考试的免费试练题都附这样的完整讲解,做完再看讲解。
