Skip to content

Commit dbe4cb1

Browse files
Create dedicated section for example and use graphql code block
1 parent 0fe73c2 commit dbe4cb1

File tree

1 file changed

+109
-1
lines changed

1 file changed

+109
-1
lines changed

src/content/docs/aegis/analytics.mdx

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Use the [GraphQL API](/analytics/graphql-api/) to get aggregate data and monitor
1111

1212
<Render file="concurrent-connections-explainer" />
1313

14-
Refer to the GraphQL Analytics API documentation to [get started](/analytics/graphql-api/getting-started/). The specific Aegis schema is called `aegisIpUtilizationAdaptiveGroups`.
14+
Refer to the [GraphQL Analytics API documentation](/analytics/graphql-api/getting-started/) for further guidance, or consider the [example](#example) below for a quickstart.
15+
16+
## Aegis schema
17+
18+
The specific Aegis schema is called `aegisIpUtilizationAdaptiveGroups`.
1519

1620
You can get average (`avg`) or maximum (`max`) utilization values (in percentage), and use the following dimensions:
1721

@@ -29,3 +33,107 @@ You can get average (`avg`) or maximum (`max`) utilization values (in percentage
2933

3034
- `popUtilizationKey` <Type text="string" />
3135
- The Cloudflare point of presence (PoP), the Aegis IP, and the origin IP and port. For example, `sjc 192.0.2.1 203.0.113.150:443`.
36+
37+
## Example
38+
39+
Refer to the query below to learn how to get average utilization and maximum utilization by point of presence, and filter the results. You can also select the button at the bottom to use this query for your account via the Cloudflare GraphQL API Explorer.
40+
41+
```graphql graphql-api-explorer "popName: "<CLOUDFLARE_POP>"" "egressIp: "<YOUR_EGRESS_IP>"" "origin: "<ORIGIN_IP_AND_PORT>""
42+
query AegisIpUtilizationQuery(
43+
$accountTag: string
44+
$datetimeStart: string
45+
$datetimeEnd: string
46+
) {
47+
viewer {
48+
utilization: accounts(filter: { accountTag: $accountTag }) {
49+
avgByPopUtilization: aegisIpUtilizationAdaptiveGroups(
50+
limit: 100
51+
filter: {
52+
datetimeFiveMinutes_geq: $datetimeStart
53+
datetimeFiveMinutes_leq: $datetimeEnd
54+
}
55+
orderBy: [datetimeFiveMinutes_ASC]
56+
) {
57+
avg {
58+
utilization
59+
}
60+
dimensions {
61+
datetimeFiveMinutes
62+
popUtilizationKey
63+
}
64+
}
65+
66+
maxByPopUtilization: aegisIpUtilizationAdaptiveGroups(
67+
limit: 100
68+
filter: {
69+
datetimeFiveMinutes_geq: $datetimeStart
70+
datetimeFiveMinutes_leq: $datetimeEnd
71+
}
72+
orderBy: [datetimeFiveMinutes_ASC]
73+
) {
74+
max {
75+
utilization
76+
}
77+
dimensions {
78+
datetimeFiveMinutes
79+
popUtilizationKey
80+
}
81+
}
82+
83+
filterPopUtilization: aegisIpUtilizationAdaptiveGroups(
84+
limit: 100
85+
filter: {
86+
datetimeFiveMinutes_geq: $datetimeStart
87+
datetimeFiveMinutes_leq: $datetimeEnd
88+
popName: "<CLOUDFLARE_POP>"
89+
}
90+
orderBy: [datetimeFiveMinutes_ASC]
91+
) {
92+
max {
93+
utilization
94+
}
95+
dimensions {
96+
datetimeFiveMinutes
97+
popUtilizationKey
98+
}
99+
}
100+
101+
filterIPUtilization: aegisIpUtilizationAdaptiveGroups(
102+
limit: 100
103+
filter: {
104+
datetimeFiveMinutes_geq: $datetimeStart
105+
datetimeFiveMinutes_leq: $datetimeEnd
106+
egressIp: "<YOUR_EGRESS_IP>"
107+
}
108+
orderBy: [datetimeFiveMinutes_ASC]
109+
) {
110+
max {
111+
utilization
112+
}
113+
dimensions {
114+
datetimeFiveMinutes
115+
popUtilizationKey
116+
}
117+
}
118+
119+
filterOriginUtilization: aegisIpUtilizationAdaptiveGroups(
120+
limit: 100
121+
filter: {
122+
datetimeFiveMinutes_geq: $datetimeStart
123+
datetimeFiveMinutes_leq: $datetimeEnd
124+
origin: "<ORIGIN_IP_AND_PORT>"
125+
}
126+
orderBy: [datetimeFiveMinutes_ASC]
127+
) {
128+
max {
129+
utilization
130+
}
131+
dimensions {
132+
datetimeFiveMinutes
133+
popUtilizationKey
134+
}
135+
}
136+
}
137+
}
138+
}
139+
```

0 commit comments

Comments
 (0)