Send Docs Feedback

Note: Most user interface tasks can be performed in Edge Classic or the New Edge experience. For an overview, getting started topics, and release notes specific to the New Edge experience, see the docs.

Get metrics organized by dimensions

Resource Summary

Security

Content Type

application/json

Category

Analytics,

retrieveandfiltermetricsforadimension

GET

Get metrics organized by dimensions

Retrieve metrics, group them by dimensions, and filter the results. 

Data delay interval
After API calls are made to proxies, it takes about 12 minutes for the data to appear in dashboards, custom reports, and management API calls.

 

The types of metrics you can retrieve (shown in the select query parameter description) include traffic, message counts, API call latency, response size, and cache hits and counts.

 

Dimensions let you view metrics in meaningful groups. For example, instead of looking at total API traffic in your organization, you can see API traffic for each API proxy.

 

For each type of dimension (or more than one dimension), you construct a request by adding the desired dimension(s) by name in the URI after /stats. This groups the data by that dimension or combination of dimensions. For example, to group metrics by API proxies, you'd use /stats/apiproxy. To group metrics by API proxy and target response code combinations, you'd comma-separate dimensions in the URI like this: /stats/apiproxy,target_response_code.

 

Following are the supported dimensions. For descriptions, see the Analytics reference.
 

access_token, api_product, apiproxy, apiproxy_revision, ax_cache_key, ax_cache_name, ax_cache_source, ax_day_of_week, ax_dn_region, ax_execution_fault_flow_name, ax_execution_fault_flow_state, ax_execution_fault_policy_name, ax_geo_city, ax_geo_continent, ax_geo_country, ax_geo_region, ax_geo_timezone, ax_hour_of_day, ax_month_of_year, ax_true_client_ip, ax_ua_agent_family, ax_ua_agent_type, ax_ua_agent_version, ax_ua_device_category, ax_ua_os_family, ax_ua_os_version, ax_week_of_month, client_id, client_ip, developer, developer_app, developer_email, environment, flow_resource, gateway_flow_id, organization, proxy_basepath, proxy_client_ip, proxy_pathsuffix, request_path, request_uri, request_verb, response_status_code, target, target_basepath, target_host, target_ip, target_response_code, target_url, useragent, virtual_host, x_forwarded_for_ip


You can also include your own custom dimensions, as described in Analyze API message content using custom analytics.

 

Here's an example that shows how to get the average response time (metric) for all API proxies (dimension) in an environment:
 

/stats/apiproxy?select=avg(total_response_time)


You can also apply filters to limit the data that's returned. For example, if you're getting message counts grouped by API proxies, you can add a filter that returns only metrics for API proxies that return 4xx or 5xx status codes. Use any available dimensions or metrics to build your filters.

For information on filters and the operators you can use, see the Analytics reference.


Sample filters
Description Filter query structure
Metrics API proxies named either api1 or api2 filter=(apiproxy in 'api1','api2')
Metrics for all API proxies except api1 and api2 filter=(apiproxy notin 'ap1','api2')
Metrics where there are no errors filter=(is_error eq 0)
Metrics where there is an error or the API proxy name is api1 or api2 filter=(is_error eq 1) or (apiproxy in 'api1','api2')
Metrics where the response status code is 4xx or 5xx filter=(response_status_code ge 400 and response_status_code le 599)

Use the additional query parameters defined in the API method to construct the complete request.

For a list of examples using this API, see Analytics command reference.

Resource URL

https://api.enterprise.apigee.com/v1 /organizations/{org_name}/environments/{env_name}/stats/{dimension_name}

Query Parameters

Name Values Description
select
(required)

Designates one or more metrics to be aggregated for the report. Following are supported metrics and aggregate functions. For descriptions, see the Analytics reference.
sum(ax_cache_executed)
avg|min|max(ax_cache_l1_count)
sum(cache_hit)
sum(is_error)
sum(message_count)
sum(policy_error)
avg|min|max(request_processing_latency)
sum|avg|min|max(request_size)
avg|min|max(response_processing_latency)
sum|avg|min|max(response_size)
sum(target_error)
sum|avg|min|max(target_response_time)
sum|avg|min|max(total_response_time)
tps (Currently must use with another metric)

Separate more than one metric with a comma. For example:

sum(message_count),tps

timeRange
(required)

The start and end time for the desired interval. The date format is MM/DD/YYYY HH:MM. For example, 04/15/2017 00:00~05/15/2017 23:59

If you have high API traffic, report generation will be faster if you use smaller time ranges, such as 2 or 3 hours.

It takes at least 10 minutes after an API call for Edge analytics to register it.

If you make a request through the API reference on this page, it automatically URL encodes the space character before HH:MM. However, if you are entering the time range in a cURL command from the command line, manually insert "%20" for the space character, in the form: MM/DD/YYYY%20HH:MM~MM/DD/YYYY%20HH:MM.

Note: Data older than six months from the current date is not accessible by default. If you want to access data older than six months, contact Apigee Support.

timeUnit

A value of second, minute, hour, day, week, month, quarter, year, decade, century, millennium.

sortby

When two or more metrics are specified, use sortby to sort results by a specific metric. For example: when you include the metricssum(message_count),sum(is_error), use a sortby of sum(message_count) to sort the results by message count.

sort

Supported sort scopes are DESC or ASC.

topk

Take 'top k' results from results, for example, to return the top 5 results 'topk=5'.

filter

Enables drill-down on specific dimension values. Don't add the word "filter", and close value in parenthesis "()". For example: (response_status_code gt 500 and response_status_code lt 599)

SmartDocs automatically URL encodes the spaces.

limit

Set the limit for the number of entries returned by the API.

offset

Use offset with limit to enable pagination of results. For example, to display results 11-20, set limit to '10' and offset to '10'.

Note: Edge ignores the offset parameter on queries that process raw fact data. For these "fact" queries, Edge uses Big Data (Apache Spark), which processes data using a parallel map-reduce technique. You can tell if the Spark query engine was used to process a query when you see something like the following in the response:

"notices" : [ "query served by:d62441a4-0951-4b90-abd3-318e86c23cf6", "Spark engine used" ]

realtime

Lets you obtain real-time query data. When set to true, queries return recently arrived API traffic data when the user-submitted time range for the query is less than one hour.

If set to false, then queries are taken from the default cloud data store, which results a delay in the availability of query data of up to three hours. This parameter overrides the accuracy query parameter setting.

accuracy

Specify that queries return data either from the raw (non-sampled) API traffic data store or from a sample of the raw API data. Queries against sampled data sets are smaller than the raw data set, and therefore run faster. You can specify the following values for the accuracy query parameter:

  • 'accuracy=0': Retrieve query data from the raw API traffic.
  • 'accuracy=1': Retrieve query data from the 1% sampled traffic table; that is, the table that is 1% in size of the raw traffic table.
  • 'accuracy=10': Retrieve query data from the 10% sampled traffic table; that is, the table that is 10% in size of the raw traffic table. Note that the realtime query parameter overrides this parameter.

Request Body

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

dimension_name Mention the dimension name true

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

dimension_name Mention the dimension name true

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

dimension_name Mention the dimension name true

org_name Mention the organization name true

dimension_name Mention the dimension name true

org_name Mention the organization name true

dimension_name Mention the dimension name true

HTTP Basic

OAuth 2.0

API Key

Reset

Make a request and see the response.

Make a request and see the response.

Make a request and see the response.

Working...

Help or comments?