How to query usage data from Image Processor

The workloadConsumptionMetrics dataset lets you get real-time aggregated data related to consumption and usage of Azion products, including Image Processor.

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. Additionally, the data is available for up to 24 months.

This guide explains how to query images processed by Image Processor using the GraphiQL Playground.


Querying Image Processor’s usage data

To query the total number of images processed by Image Processor, proceed as follows:

  1. Access the GraphiQL Playground by going to 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.
  2. Send a query following this format:
query {
workloadConsumptionMetrics(
filter: {
tsRange: {
begin: "2025-02-01T00:00:00",
end: "2025-03-01T00:00:00",
}
productId: 1441110021
metricName: "images_processed"
}
aggregate: {
sum: accounted
}
limit: 10000
groupBy: [clientId, workloadId, productId, metricName]
) {
clientId
workloadId
productId
metricName
total: sum
}
}

Where:

FieldDescription
filterDefines the criteria used to filter the data returned by the query.
tsRangeA 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: accountedAs a subfield of aggregate, calculates the total accounted usage for events matching the query’s filters and groups.
limitSpecifies the maximum number of results to return. System maximum: 10000.
groupBySpecifies the fields by which the query results should be grouped. Example: [clientId, metricName].
productIdUnique identifier of the product being used. In this case, 1441110021 for Image Processor.
metricNameName of the calculated metric for analytics. In this case, images_processed.
  1. You’ll receive a JSON response similar to this:
{
"data": {
"workloadConsumptionMetrics": [
{
"clientId": "0000z",
"workloadId": 4829103746,
"productId": 1441110021,
"metricName": "images_processed",
"total": 32
},
{
"clientId": "0000z",
"workloadId": 1938475620,
"productId": 1441110021,
"metricName": "images_processed",
"total": 19478
},
{
"clientId": "0000z",
"workloadId": 7584931026,
"productId": 1441110021,
"metricName": "images_processed",
"total": 299612
},
{
"clientId": "0000z",
"workloadId": 6203849175,
"productId": 1441110021,
"metricName": "images_processed",
"total": 1432
},
{
"clientId": "0000z",
"workloadId": 3948571023,
"productId": 1441110021,
"metricName": "images_processed",
"total": 268675
}
]
}
}

Where:

FieldDescription
clientIdClient unique identifier on Azion. Example: 8437r.
workloadIdIdentifier for the workload associated with the usage. Example: 4829301746.
productIdUnique identifier of the product being used. In this case, 1441110021 for Image Processor.
metricNameName of the measured metric for analytics. Example: images_processed.
totalTotal number of images processed by Image Processor. This field is the result of a sum. Example: 268675.

Contributors