Send Docs Feedback

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 the following dimensions:
 

access_token, api_product, apiproxy_revision, apiproxy, ax_cache_key, ax_cache_name, ax_cache_source, ax_channel_id, 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_app, developer_email, developer, environment, gateway_flow_id, gateway_source, organization, proxy_basepath, proxy_client_ip, proxy_pathsuffix, request_path, request_uri, request_verb, response_status_code, target_basepath, target_host, target_ip, target_response_code, target_url, target, useragent, virtual_host, x_forwarded_for_ip

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

or, for multiple dimensions:

/stats/apiproxy,environment

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.


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


/stats/apiproxy?select=avg(total_response_time)

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


You can also filter results with expressions to show only those you care about.

Operator Description
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=(is_error eq 0)
Stats where there is no error messages or the API proxy name is api1 or api2 filter=(is_error 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 (is_error 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)

Following are the metrics you can use, along with the supported functions:

  • message_count (sum)
  • tps (no functions)
  • is_error (sum)
  • policy_error (sum)
  • target_error (sum)
  • request_processing_latency (avg, min, max)
  • request_size (sum, avg, min, max)
  • response_processing_latency (avg, min, max)
  • response_size (sum, avg, min, max)
  • target_response_time (sum, avg, min, max)
  • total_response_time (sum, avg, min, max)
  • cache_hit (sum)
  • ax_cache_l1_count (avg, min, max)
  • ax_cache_executed (sum)

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, 02/17/2017 00:00~02/17/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

Lets you sort by one of the select criteria. For example, if select=sum(message_count),sum(is_error), you can set sortby=sum(message_count) to sort the results by message count.

Sorting is important when using pagination (for example, when you use the limit and offset parameters), because it ensures consistent results. Without sorting, results aren't guaranteed to be in a consistent order.

sort

Sort the results by highest to lowest with DESC (the default) or lowest to highest with 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 10-19, set limit to '10' and offset to '10'. (0 counts as the first item.)

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

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?