1. Dashboard Rule#

Folder: Edge
Dashboard: CloudFront - Overview

Rows:
    Overview:
        requests、error rate、cache hit、origin latency、traffic

    Drilldown:
        按 distribution / status code / cache behavior / region 拆开看

    Capacity:
        request / bandwidth trend、cache efficiency、origin pressure

    Debug:
        real-time metrics、TLS、origin status、geo / cache behavior 细节,不放第一屏;排查 CDN 行为异常时查看

2. Overview#

Panel Metrics Why
Requests Requests CDN traffic 基线
Total error rate TotalErrorRate 用户侧错误总览
4xx / 5xx error rate 4xxErrorRate, 5xxErrorRate 区分 client / server / origin 问题
Cache hit rate CacheHitRate CDN 是否有效减轻 origin 压力
Origin latency OriginLatency if enabled origin 慢会直接影响 miss 请求
Traffic bytes BytesDownloaded, BytesUploaded 带宽趋势和成本信号

3. Drilldown#

Panel Metrics Why
Error by distribution error rate by distribution 找到异常 distribution
Status code split 4xx / 5xx metrics 区分 client、edge、origin 问题
Cache behavior split cache hit / miss by behavior if collected 找到命中率差的 path pattern
Origin pressure origin latency and origin request metrics if enabled 找到 origin 承压点
Geo / edge split real-time logs / metrics if enabled 区域性故障排查

4. Capacity#

Panel Metrics Why
Request trend Requests 业务增长
Bandwidth trend BytesDownloaded, BytesUploaded 成本和容量规划
Cache hit trend CacheHitRate 评估 cache policy / TTL 效果
Origin latency trend OriginLatency 识别 origin 长期变慢
Error rate trend TotalErrorRate, 5xxErrorRate 观察发布或流量增长后的质量变化

5. Debug#

Panel Metrics Why
Real-time metrics real-time metrics if enabled 秒级排障,成本更高,不默认放 overview
TLS / cert expiry external blackbox / certificate exporter CloudFront 证书有效期需要外部补充监控
Origin status sample CloudFront logs / real-time logs dashboard 看趋势,日志看具体 URL
WAF signals WAF metrics if attached 只有接入 WAF 时展示

6. YACE Metrics#

如果 CloudFront dashboard 使用 aws_cloudfront_* metrics,需要 YACE 采集 AWS/CloudFront。CloudFront 的 CloudWatch metrics 通常在 us-east-1 查询。

YACE config:

apiVersion: v1alpha1
sts-region: us-east-1
discovery:
  jobs:
    - type: AWS/CloudFront
      regions:
        - us-east-1
      customTags:
        - key: environment
          value: uat
      period: 300
      length: 600
      nilToZero: true
      metrics:
        - name: Requests
          statistics: [Sum]
        - name: TotalErrorRate
          statistics: [Average]
        - name: 4xxErrorRate
          statistics: [Average]
        - name: 5xxErrorRate
          statistics: [Average]
        - name: CacheHitRate
          statistics: [Average]
        - name: OriginLatency
          statistics: [Average, p95, p99]
        - name: BytesDownloaded
          statistics: [Sum]
        - name: BytesUploaded
          statistics: [Sum]

确认 metric name:

{__name__=~"aws_cloudfront_.*"}

7. Do Not Put In Overview#

不要放:
    每个 URL / User-Agent / edge location 明细
    real-time logs 内容
    WAF rule 明细

原因:
    CloudFront overview 重点是 request、error rate、cache hit、origin latency、traffic