Cloudflare Analytics 提供一系列数据集,包括通用和产品特定的数据集。数据集使用一致的命名方案,明确标识它们返回的数据类型:
-
Domain — 每个数据集以其描述的 field 命名,并与一组 node 关联。产品特定的数据 node 包含相关产品名称,例如
loadBalancingRequests*node。 -
Adaptive Sampling — 表示使用 adaptive sampling 获取数据的 node 包含
Adaptive后缀。更多详情,请参阅 sampling。 -
Aggregated data — 表示聚合数据的 node 包含
Groups后缀。例如,loadBalancingRequestsAdaptiveGroupsnode 表示 Load Balancing 请求的聚合数据。聚合数据在...Group对象数组中返回。请注意:我们有一个 node 目前排除在该命名约定之外 —workersInvocationsAdaptive(beta)。 -
Raw data — 如
loadBalancingRequestsAdaptive等原始数据 node 未聚合,因此不包含Groups后缀。原始数据在包含相关数据类型对象的数组中返回。例如,对loadBalancingRequestsAdaptive的查询返回各种LoadBalancingRequest对象。
要了解更多关于数据集、可用性、Beta 和弃用状态的信息,请参阅 GraphQL discovery 功能。
此示例说明 Groups 的结构:
type WhateverGroup {
count # No subfields, it is just the group size. Not available for roll-up tables.
sum {
# fields that support summing (numbers, maps of numbers)
}
avg {
# fields that support averaging (numbers)
}
uniq {
# fields that support uniqueing (numbers, strings, enums, IPs, dates, etc.)
}
}唯一值不能作为维度使用,但可以如本示例所示进行查询:
{
# Get number of bytes and unique IPs in each minute.
httpRequests1mGroups {
sum {
bytes
}
uniq {
uniques # unique IPs
}
dimensions {
datetimeMinute
}
}
# Count the number of events in each hour.
firewallEventsAdaptiveGroups {
count
dimensions {
datetimeHour
}
}
}每个暴露的表都有 GraphQL type 定义。Type 定义遵循以下规则:
- 常规 field 代表自身。
- 每个 field(包括嵌套 field)都有 type 并表示该 type 的列表。
enumtype 表示枚举 field。
以下是 ContentTypeMapElem 的 type 定义示例:
type ContentTypeMapElem {
edgeResponseContentType: UInt32!
requests: UInt64!
bytes: UInt64!
}
# An array of httpRequestsGroup is the result of httpRequests1hGroups or
# httpRequests1mGroups query.
type httpRequestsGroup {
date: Date!
timeslot: DateTime!
requests: UInt64!
contentTypeMap: [ContentTypeMapElem!]!
# ... other fields
}
enum TrustedClientCategory {
UNKNOWN
REAL_BROWSER
HONEST_BOT
}
# An array of Request is the result of httpRequests query.
type Request {
trustedClientCategory: TrustedClientCategory!
# ... other fields
}