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 for a dimension

Resource Summary

Security

Content Type

application/json, text/xml

Category

Analytics,

retrieveandfiltermetricsforadimension

GET

Get metrics for a dimension

Retrieve and filter metrics for a dimension. For a list of examples using this API, see Analytics command reference.

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.

 

Apigee Edge records and aggregates metrics for dimensions, where Edge defines 3 classes of dimensions:
 

  • Pre-computed, static dimensions used for operational dashboards.
  • Dynamic dimensions, whose metrics are computed 'on-demand' when a report is built.
  • Custom dimensions, which enable you to build reports based on message content.
For each type of dimension, you construct a request by adding the desired dimension by name as a URI parameter following /stats. This groups the data by that dimension. For example: /stats/apiproxy. Following are the supported dimensions:

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 define queries against the collected metrics by specifying metrics, type of calculation to run, time range, and, optionally, any filters to use for drill-down into the data set that is returned by the query.

For pre-computed metrics, only simple calculations are needed, since the specific function used to perform the calculation is embedded in the metric.

To generate custom reports, you select a metric + optional aggregate function calculation to run over the specified dimensions. The possible aggregate functions are: count, avg, min, max, sum.

The base request to create a custom report that calculates average response time for all APIs in an environment is:

/stats/apis?select=avg(total_response_time)
Use the additional query parameters defined in the API method to construct the complete request.

Filters can be applied to custom resources. Custom resources are:
Symbol Operation
in for list inclusion
notin for list exclusion
eq =
ne != or
gt >
lt <
ge >=
le <=

Sample filters
Description Filter query structure
Stats for API proxies named either api1 or api2 filter=(apiproxy in 'api1','api2')
Stats for all API proxies except api1 and api2 filter=(apiproxy notin 'ap1','api2')
Stats where there are no errors filter=(iserror eq 0)
Stats where there is no error messages or the API proxy name is api1 or api2 filter=(iserror eq 1) or (apiproxy in 'api1','api2')
Stats where (response code is either 201 or 301) and (there are errors) or (API proxy name is either api1 or api2) filter=(response_status_code le 201 or response_status_code eq 301)
and (iserror eq 1) or (apiproxy in 'api1','api2')

 

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. Supported metrics and aggregate functions are:
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

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

sum(message_count),avg(total_response_time)

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 select values are specified, sortby can be used to specify the select used for sorting results: message_count, is_error, total_response_time, max_response_time, min_response_time, data_exchange_size, end_point_response_time.

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. Enclose 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?