How to query usage data from Edge Application
The workloadConsumptionMetrics dataset lets you get real-time aggregated data related to consumption and usage of Azion Products, including Edge Application.
The information can be accessed through the GraphQL API, allowing you to transfer this data to a third-party platform, and enabling you to further analyze and review it. Additionally, the data is available for up to 24 months.
Using the GraphiQL Playground, you can query data related to:
data_transferred_total
: total amount of data transferred through Edge Application.requests
: total number of requests received and processed by Edge Application.waf_requests
: total number of requests inspected by WAF.
Querying processed requests and total data transferred
To query the total of processed requests and data transferred by Edge Application, proceed as follows:
- Access the GraphiQL Playground at the following link:
https://api.azion.com/v4/consumption/graphql
.- You must be logged in to your Azion account. Otherwise, you’ll receive an error message.
- Send a query following this format:
query { workloadConsumptionMetrics( filter: { tsRange: { begin: "2025-02-01T00:00:00", end: "2025-03-01T00:00:00", } isEdgeFirewallActive: true productId: 1441740010 metricNameIn: ["requests", "data_transferred_total"] } aggregate: { sum: accounted } limit: 10000 groupBy: [clientId, workloadId, productId, metricName] ) { clientId workloadId productId metricName total: sum }}
Where:
Field | Description |
---|---|
filter | Defines the criteria used to filter the data returned by the query. |
tsRange | A subfield of filter . Specifies a time range for filtering data. It includes begin and end fields to define the start and end timestamps. Format: "YYYY-MM-DDTHH:mm:ss" ; example: "2024-04-11T00:00:00" . |
sum: accounted | As a subfield of aggregate , calculates the total accounted usage for events matching the query’s filters and groups. |
limit | Specifies the maximum number of results to return. System maximum: 10000 . |
groupBy | Specifies the fields by which the query results should be grouped. Example: [clientId, metricName] . |
productId | Unique identifier of the product being used. In this case, 1441740010 for Edge Application. |
metricName | Name of the calculated metric for analytics. In this case, requests and data_transferred_total . |
isEdgeFirewallActive: true | Optional. Filters transferred data with Edge Firewall active. Available values: isEdgeFirewallActive , isLoadBalancerActive , isImageProcessorActive , and isApplicationAcceleratorActive . |
- You’ll receive a JSON response similar to this:
{ "data": { "workloadConsumptionMetrics": [ { "clientId": "0000z", "workloadId": 4829103746, "productId": 1441740010, "metricName": "data_transferred_total", "total": 32 }, { "clientId": "0000z", "workloadId": 1938475620, "productId": 1441740010, "metricName": "requests", "total": 19478 }, { "clientId": "0000z", "workloadId": 7584931026, "productId": 1441740010, "metricName": "data_transferred_total", "total": 299612 }, { "clientId": "0000z", "workloadId": 6203849175, "productId": 1441740010, "metricName": "requests", "total": 1432 }, { "clientId": "0000z", "workloadId": 3948571023, "productId": 1441740010, "metricName": "data_transferred_total", "total": 268675 } ] }}
Where:
Field | Description |
---|---|
clientId | Client unique identifier on Azion. Example: 8437r . |
workloadId | Identifier for the workload associated with the usage. Example: 4829301746 . |
productId | Unique identifier of the product being used. In this case, 1441740010 for Edge Application. |
metricName | Name of the measured metric for analytics. Example: requests and data_transferred_total . |
total | For data_transferred_total , total number of data transferred by Edge Application. This field is the result of a sum, in bytes. Example: 268675 . For requests : total number of requests processed. This field is the result of a sum. Example: 1112 . |
Querying requests inspected by WAF
To query the total number of requests inspected by WAF, proceed as follows:
- Access the GraphiQL Playground at the following link:
https://api.azion.com/v4/consumption/graphql
.- You must be logged in to your Azion account. Otherwise, you’ll receive an error message.
- Send a query following this format:
query { workloadConsumptionMetrics( filter: { tsRange: { begin: "2025-02-01T00:00:00", end: "2025-03-01T00:00:00", } isEdgeFirewallActive: true productId: 1441740010 metricName: "waf_requests" } aggregate: { sum: accounted } limit: 10000 groupBy: [clientId, workloadId, productId, metricName] ) { clientId workloadId productId metricName total: sum }}
Where:
Field | Description |
---|---|
filter | Defines the criteria used to filter the data returned by the query. |
tsRange | A subfield of filter . Specifies a time range for filtering data. It includes begin and end fields to define the start and end timestamps. Format: "YYYY-MM-DDTHH:mm:ss" ; example: "2024-04-11T00:00:00" . |
sum: accounted | As a subfield of aggregate , calculates the total accounted usage for events matching the query’s filters and groups. |
limit | Specifies the maximum number of results to return. System maximum: 10000 . |
groupBy | Specifies the fields by which the query results should be grouped. Example: [clientId, metricName] . |
productId | Unique identifier of the product being used. In this case, 1441740010 for Edge Application. |
metricName | Name of the calculated metric for analytics. In this case, waf_requests . |
isEdgeFirewallActive: true | Optional. Filters transferred data with Edge Firewall active. Available values: isEdgeFirewallActive , isLoadBalancerActive , isImageProcessorActive , and isApplicationAcceleratorActive . |
- You’ll receive a JSON response similar to this:
{ "data": { "workloadConsumptionMetrics": [ { "clientId": "0000z", "workloadId": 4829103746, "productId": 1441740010, "metricName": "waf_requests", "total": 32 }, { "clientId": "0000z", "workloadId": 1938475620, "productId": 1441740010, "metricName": "waf_requests", "total": 19478 }, { "clientId": "0000z", "workloadId": 7584931026, "productId": 1441740010, "metricName": "waf_requests", "total": 299612 }, { "clientId": "0000z", "workloadId": 6203849175, "productId": 1441740010, "metricName": "waf_requests", "total": 1432 }, { "clientId": "0000z", "workloadId": 3948571023, "productId": 1441740010, "metricName": "waf_requests", "total": 268675 } ] }}
Where:
Field | Description |
---|---|
clientId | Client unique identifier on Azion. Example: 8437r . |
workloadId | Identifier for the workload associated with the usage. Example: 4829301746 . |
productId | Unique identifier of the product being used. In this case, 1441740010 for Edge Application. |
metricName | Name of the measured metric for analytics. Example: waf_requests . |
total | Total number of requests processed by Edge Application. This field is the result of a sum. Example: 268675 . |
Contributors