Create custom reports

Custom reports enable you to drill-down into specific API metrics and view the exact data that you want to see. From the API Monitoring dashboards, you can create a custom report with the filter and metrics preset based on the configured conditions at time of creation. In addition, a set of default dimensions and metrics are configured in the report for you.

Create a custom report based on your context

Quickly create custom reports based on your context as summarized in the following table. On the Custom Reports page, custom reports that are created using API Monitoring are named uniquely (by default), as indicated in the table; you can change the name when editing the custom report.

Custom report context Default naming convention for custom report
Recent dashboard API Monitoring Recent Generated
Timeline dashboard API Monitoring Timeline Generated
Investigate dashboard API Monitoring Investigate Generated
Alert condition API Monitoring Generated: alert-name

Default dimension and metrics

The custom report will include the dimensions and metrics listed in the following table for all API Monitoring generated reports, by default.

Component Defaults
Dimensions Request URI
Metrics
  • Total response time
  • Target response time
  • Proxy errors
  • Target errors

Edit the custom report

As mentioned in the previous section, a predefined set of API Monitoring default dimensions and metrics are preconfigured in custom reports. After it is created, you can edit the custom report to add or delete metrics and dimensions, as required. For example, you might want to narrow your investigation to a particular access token, developer app, API proxy, or request ID.

In the following custom report, you add the predefined Gateway Flow ID dimension, where Gateway Flow ID contains the unique UUID of each API request made to Edge. Note that the report already uses the Request URI dimension:

The following example adds the Client ID dimension to the custom report. The Client ID dimension contains the consumer key (API key) of the developer making the API call, whether passed in the request as an API key or included in an OAuth token:

The custom report contains information for all Client ID values. The next example adds a filter so you can create a custom report for a specific Client ID:

For more information on all predefined dimensions and metrics that you can add to a report, see Analytics metrics, dimensions, and filters reference.

In the next example, you add a Filter to a custom report that captures the default metrics and dimensions for policies.ratelimit.QuotaViolation fault code and 5xx status codes:

For complete details about how to edit a custom report, see Manage custom reports.

Collect custom metrics using the Statistics Collector policy

Attach the Statistics Collector policy to your API proxies to collect custom metrics for data in a message, such as user or product ID, price, REST action, target version, target URL, and message length. The data can come from flow variables predefined by Apigee, request headers, query params, or custom variables that you define.

For example, requests to your API proxy include headers for the product ID, user ID, and target server version. This request could be in the form:

curl -H "prodid:123456" -H "userid:98765" -H "targetversion:beta" http://myapi.com/myapi

To collect custommetrics for these headers and also to collect data on the predefined request.header.names variable:

  1. Add the Statistics Collector policy to your API to capture the value of the custom headers and on the request.header.names variable. For example:

    <StatisticsCollector name="publishPurchaseDetails">
      <Statistics>
        <Statistic name="requestHeaders" ref="request.header.names" type="string"></Statistic>
        <Statistic name="prodid" ref="request.header.prodid" type="string">none</Statistic>
        <Statistic name="userid" ref="request.header.userid" type="integer">0</Statistic>
        <Statistic name="targetversion" ref="request.header.targetversion" type="string">alpha</Statistic>
      </Statistics>
    </StatisticsCollector>
    

    For more information about the flow variables, see Request message variables.

  2. Generate a custom report that includes the values of these custom metrics as a Dimension.