跳转到内容
搜索文档

分析

最后更新 查看 MarkdownAgent 设置

使用负载均衡分析,您可以:

  • 评估流量走向。
  • 检查池中端点的健康状态。
  • 回顾池及池健康随时间的变化。

仪表板 Analytics

概览指标

要查看负载均衡器的 Overview(概览) 指标,前往 Traffic(流量) > Load Balancing Analytics(负载均衡分析)

这些指标显示路由到负载均衡器内特定池的请求数量,帮助您:

  • 评估添加或移除池的效果。
  • 决定何时创建新池。
  • 规划峰值流量需求和未来基础设施需求。

为特定池、时间、区域和端点添加其他筛选条件。

延迟

Latency(延迟) 指标显示交互式地图,帮助您识别 Unhealthy(不健康)Slow(缓慢) 池的区域。

要查看负载均衡器的延迟信息,前往 Traffic(流量) > Load Balancing Analytics(负载均衡分析) > Latency(延迟)

Logs

Logs(日志) 提供所有端点状态变更的历史记录及其对负载均衡池的影响。Load Balancing 仅记录代表端点状态变更的事件,从健康变为不健康或反之。

当监视器组附加到池时,每个记录的健康事件包含 monitors 字段。 此字段列出组内的各个监视器及其结果,更容易看到哪个监视器导致了状态变更。

示例事件(截断):

{
	"id": <id>,
	"timestamp": "2025-09-22 19:22:00",
	"pool": {
		"id": "<id>",
		"name": "example-monitor-group-test-pool-us",
		"healthy": true,
		"changed": false,
		"minimum_origins": 1
	},
	"origins": [
		{
			"name": "origin-a",
			"ip": "192.0.2.10",
			"enabled": true,
			"healthy": true,
			"failure_reason": "No failures",
			"response_code": 200,
			"monitors": [
				{
					"id": "<id>",
					"healthy": true,
					"failure_reason": "No failures",
					"response_code": 200,
					"must_be_healthy": true,
					"monitoring_only": false
				},
				{
					"id": "<id>",
					"healthy": true,
					"failure_reason": "No failures",
					"response_code": 200,
					"must_be_healthy": true,
					"monitoring_only": false
				},
				{
					"id": "<id>",
					"healthy": false,
					"failure_reason": "HTTP timeout occurred",
					"must_be_healthy": false,
					"monitoring_only": true
				}
			]
		},
		{
			"name": "origin-b",
			"ip": "198.51.100.25",
			"enabled": true,
			"healthy": false,
			"failure_reason": "TCP connection failed",
			"changed": true,
			"monitors": [
				{
					"id": "<id>",
					"healthy": false,
					"failure_reason": "TCP connection failed",
					"must_be_healthy": true,
					"monitoring_only": false
				},
				{
					"id": "<id>",
					"healthy": true,
					"failure_reason": "No failures",
					"response_code": 200,
					"must_be_healthy": true,
					"monitoring_only": false
				},
				{
					"id": "<id>",
					"healthy": false,
					"failure_reason": "HTTP timeout occurred",
					"must_be_healthy": false,
					"monitoring_only": true
				}
			]
		}
	]
}

在此示例中:

  • 每个源站包含 monitors 数组,列出附加组内的所有监视器。
  • must_be_healthymonitoring_only 等字段指示每个监视器在确定源站整体健康状态中的角色。
  • healthyfailure_reason 字段显示哪些单独的监视器检查成功或失败。

要在仪表板中访问日志,前往 Traffic(流量) > Load Balancing Analytics(负载均衡分析)

GraphQL Analytics

如需更大灵活性,请直接从 GraphQL Analytics API 获取负载均衡指标。

从示例查询开始:

每个池的请求数

此查询显示 Cloudflare 全球网络中每个位置每个池收到的请求数量。

Querygraphql
query RequestsPerPool($zoneTag: string, $start: Time, $end: Time) {
	viewer {
		zones(filter: { zoneTag: $zoneTag }) {
			loadBalancingRequestsAdaptiveGroups(
				limit: 100
				filter: {
					datetime_geq: $start
					datetime_leq: $end
					lbName: "lb.example.com"
				}
				orderBy: [datetimeFifteenMinutes_DESC]
			) {
				count
				dimensions {
					datetimeFifteenMinutes
					coloCode
					selectedPoolName
				}
			}
		}
	}
}
Response (truncated)json
{
    "data": {
        "viewer": {
            "zones": [
                {
                    "loadBalancingRequestsAdaptiveGroups": [
                        {
                            "count": 4,
                            "dimensions": {
                                "coloCode": "IAD",
                                "datetimeFifteenMinutes": "2021-06-26T00:45:00Z",
                                "selectedPoolName": "us-east"
                            }
                        },
                        ...
                    ]
                }
            ]
        }
    }
}

每个数据中心的请求数

此查询显示从特定数据中心(例如新加坡或 SIN)到负载均衡器中每个池的监视器请求的加权往返时间(RTT)测量值(avgRttMs)。

Querygraphql
query RequestsPerDataCenter($zoneTag: string, $start: Time, $end: Time) {
	viewer {
		zones(filter: { zoneTag: $zoneTag }) {
			loadBalancingRequestsAdaptive(
				limit: 100
				filter: {
					datetime_geq: $start
					datetime_leq: $end
					lbName: "lb.example.com"
					coloCode: "SIN"
				}
				orderBy: [datetime_DESC]
			) {
				selectedPoolName
				pools {
					poolName
					healthy
					healthCheckEnabled
					avgRttMs
				}
			}
		}
	}
}
Response (truncated)json
{
    "data": {
        "viewer": {
            "zones": [
                {
                    "loadBalancingRequestsAdaptive": [
                        {
                            "pools": [
                                {
                                    "avgRttMs": 67,
                                    "healthCheckEnabled": 1,
                                    "healthy": 1,
                                    "poolName": "asia-ne"
                                },
                                {
                                    "avgRttMs": 156,
                                    "healthCheckEnabled": 1,
                                    "healthy": 1,
                                    "poolName": "us-east_and_asia-ne"
                                },
                                {
                                    "avgRttMs": 237,
                                    "healthCheckEnabled": 1,
                                    "healthy": 1,
                                    "poolName": "us-east"
                                },
                            ],
                            "selectedPoolName": "asia-ne"
                        },
                    ...
                    ]
                }
            ]
        }
    }
}

这篇文档对您有帮助吗?