Features GraphQL API
GraphQL features consist of datasets, filtering, sorting, and pagination. The features provide easy access to your data, and using and combining the available features creates more personalized and specific queries to request the exact information you need.
The next sections will detail each available feature of GraphQL and how to use them.
Datasets
Azion GraphQL API uses defined datasets to indicate what requests you can run through queries and fetches data from Real-Time Metrics and Real-Time Events. They consist of organized tables informing your data.
Find each available dataset and what they request next.
Real-Time Metrics GraphQL API
Dataset | Description |
---|---|
dataStreamedMetrics | Sent events of data by Data Stream to the clients’ endpoint |
edgeFunctionsMetrics | Events executed by Edge Functions |
httpMetrics | Request events registered by Edge Application and Edge Firewall |
edgeDnsQueriesMetrics | Query events performed on Edge DNS |
imagesProcessedMetrics | Image processing events by Image Processor |
tieredCacheMetrics | Request events registered by Tiered Cache |
connectedUsersMetrics | Query the number of users connected to your applications, using Live Ingest |
botManagerMetrics | Query the number of requests evaluated and the actions performed by Azion Bot Manager (if subscribed) |
botManagerBreakdownMetrics | Query the URLs most impacted by bad bots, according to Azion Bot Manager data (if subscribed) |
Real-Time Events GraphQL API
Dataset | Description |
---|---|
activityHistoryEvents | Events logs from an account on Azion Console regarding activities registered on Activity History. It stores data for 2 years and exhibits data starting from September 22nd, 2023. |
cellsConsoleEvents | Events logs from applications using Azion Runtime returned by the Cells Console. |
dataStreamedEvents | Sent events of data by Data Stream to the clients’ endpoint. |
edgeFunctionsEvents | Events executed by Edge Functions. |
httpEvents | Request events registered by Edge Application and Edge Firewall. |
edgeDnsQueriesEvents | Query events performed on Edge DNS. |
imagesProcessedEvents | Image processing events by Image Processor. |
tieredCacheEvents | Request events registered by Tiered Cache. |
telemetryDeviceInfoEvents | Events related to the device being used for access and recorded by Azion Mobile SDK, both at the hardware and software levels. |
telemetrySensorsEvents | Events related to the device’s sensors recorded by Azion Mobile SDK, such as touchscreen interactions and gyroscope information. |
Billing GraphQL API
Dataset | Description |
---|---|
balanceFinancialEntry | Logs regarding types of financial entries and monetary values |
paymentsClientDebt | Logs regarding client’s debts and payments and monetary values |
Accounting GraphQL API
Dataset | Description |
---|---|
accountingDetail | Logs regarding accounted data for products and its metrics |
You can request both the raw model, using the Events datasets, and the aggregated model, using the Metrics datasets.
Go to raw queries referenceGo to aggregated queries reference
Go to How to query aggregated data guide
Filtering
With filtering parameters, responses returned by your queries can be more accurate to your set of data. You can use filtering with any available field in the dataset you’re consulting.
As requesting complex or a large amount of data can cause responses to get noisy and complicate its use, filtering queries helps with getting exact and direct data from your requests. For example, if you’re using the following query to request httpMetrics
:
You can filter the query by requesting data specific to the geolocCountryName
field:
You can feel free to update your request to use a field of your interest within the fields of the dataset you’re consulting.
You can also filter using multiple AND
and OR
parameters. Make sure you define all the fields you’re filtering for inside the parameter, like in the following example:
Sorting
The sorting feature lets you organize and sort the received data of a dataset according to the event’s order. For example, if you’re receiving the host
field data as a response to your API request, you can sort the data to receive it in:
- An ascending order (ASC)
- A descending order (DESC)
Whenever you use the orderBy
property, you must add either the ASC
or the DESC
specification.
For example, to use the ascending order sorting feature, you need to add orderBy
in your query and the field you want to sort + ASC
:
To sort the data according to a descending order (DESC), you need to add the field you want to sort + DESC
:
Say you’re using this query with DESC
:
You’ll get a response similar to this:
And if you’re using this query with ASC
:
You’ll get a response similar to this:
Pagination
Pagination is a feature designed to help you decide where you want your results to begin from and how many results you want to see. Currently, Azion GraphQL API uses offset and limit pagination to provide the feature.
Using pagination can be useful when you get a large number of data in response to your API request. You can use the feature by setting offsets and limits. This way, the API knows it needs to return data within the specific range you’ve set.
The offsets parameter sets the number of records you want to skip in your data response, and the limits parameter sets the number of results you want to receive.
See the following example on how to set offset and limit parameters:
The offset is set for 15, meaning your response will start with the 16th result, and the limit is set for 30, meaning your response will give you a total of 30 results. In this case, you’ll receive a response from the 16th result until the 45th result.
Resampling
Available for:
The Resample feature allows you to resample your data to display a smaller amount of data points being exhibited on charts. It works according to the rule you pass in the function
field.
You can use it to complement the limit you add to your query, as the default data points in charts may not be the ideal number for your analysis.
The query must contain the function
field and its properties as well as have the groupBy
field containing the ts
variable.
By specifying sum
, you’ll receive a total sum of the data points in that interval. By specifying mean
, you’ll receive a calculation of sum + division.
See an example:
Say your original query result, without resampling, returned 1,456 logs. Since you queried for a resample of 100 points, the calculation the API does is 1,456 // 100 = 14,56 minutes interval
. Since the API only uses integers (whole numbers), it’ll round up the result to an interval of 14 minutes between each point returned.
However, the API doesn’t discard the remaining 0,56 minutes
. It keeps adding them until the number becomes an integer and them sums it to the original requested points.
In the example used, it returned the original 100
requested points plus the reamaining 4
points, resulting in a total of 104 points
for the resampled query.