View Pay-as-you-go resource usage

This page applies to Apigee, but not to Apigee hybrid.

View Apigee Edge documentation.

There are several tools you can use to view and monitor your Apigee resource use. This topic discusses how billing or organization administrators can:

To view organization resource usage and configure alerts, you need the following roles:

  • Apigee Organization Admin (roles/apigee.admin)
  • Logs Viewer (roles/logging.viewer)
  • Billing Account Viewer (roles/billing.viewer)

View resource usage in Metrics Explorer

You can use Metrics Explorer to view usage of the Apigee resources that are key attributes in determining cost in your Pay-as-you-go pricing plan. By selecting specific metrics and filters, you can generate a usage report for Apigee proxy/shared flow deployment units or Apigee active environments, or both.

For detailed information about the Apigee metrics and their possible values, see apigee on the Google Cloud metrics page.

Apigee proxy/shared flow deployment unit usage

Metrics Explorer UI

To view Apigee proxy/shared flow deployment unit usage in Metrics Explorer, use the following steps:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the Select a metric pane, expand the Metric menu and enter Apigee in the filter bar.

    Use the submenus to select the resource type, category, and metric:

    1. In the Active resources menu, select Apigee proxy (v2).
    2. In the Active metric categories menu, select Proxyv2.
    3. In the Active metrics menu, select Apigee proxy details.
  3. Click Apply.
  4. In the Filters section:
    1. Use the Group By menu to group by resource label. Select both proxy_deployment_type and env from the list options to group by proxy deployment type and environment.
    2. Click OK to apply the filters.
  5. Select Count from the Grouping function menu.

MQL

To view Apigee proxy/shared flow deployment unit usage with an MQL query:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the toolbar of the Select a metric pane, select Code Editor.
  3. To use MQL:
    1. Select MQL in the Language toggle.
    2. Enter the following query into the query editor:
      fetch apigee.googleapis.com/ProxyV2
      | metric 'apigee.googleapis.com/proxyv2/details'
      | group_by [metric.proxy_deployment_type, resource.env]

PromQL

To view Apigee proxy/shared flow deployment unit usage with a PromQL query:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the toolbar of the Select a metric pane, select Code Editor.
  3. To use PromQL:
    1. Select PromQL in the Language toggle.
    2. Enter the following query into the query editor:
      count(apigee_googleapis_com:proxyv2_details{monitored_resource="apigee.googleapis.com/ProxyV2"}) by (proxy_deployment_type, env)

Apigee active environment usage

Metrics Explorer UI

To view Apigee active environment usage in Metrics Explorer, use the following steps:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the Select a metric pane, expand the Metric menu and enter Apigee in the filter bar.

    Use the submenus to select the resource type, category, and metric:

    1. In the Active resources menu, select Apigee environment.
    2. In the Active metric categories menu, select Environment.
    3. In the Active metrics menu, select Apigee active environment.
  3. Click Apply.
  4. In the Filters section:
    1. Use the Group By menu to group by resource label. Select type from the list options to group by environment type.
    2. Click OK to apply the filters.
  5. Select Count from the Grouping function menu.

MQL

To view Apigee active environment usage with an MQL query:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the toolbar of the Select a metric pane, select Code Editor.
  3. To use MQL:
    1. Select MQL in the Language toggle.
    2. Enter the following query into the query editor:
      fetch apigee.googleapis.com/Environment
      | metric 'apigee.googleapis.com/environment/active'
      | group_by [metric.type, resource.env]

PromQL

To view Apigee active environment usage with a PromQL query:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the toolbar of the Select a metric pane, select Code Editor.
  3. To use PromQL:
    1. Select PromQL in the Language toggle.
    2. Enter the following query into the query editor:
      count(apigee_googleapis_com:environment_active{monitored_resource="apigee.googleapis.com/Environment"}) by (env, type)

Standard and Extensible API calls

Metrics Explorer UI

To view Standard and Extensible API calls by environment in Metrics Explorer, use the following steps:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the Select a metric pane, expand the Metric menu and enter Apigee in the filter bar.

    Use the submenus to select the resource type, category, and metric:

    1. In the Active resources menu, select Apigee environment.
    2. In the Active metric categories menu, select Environment.
    3. In the Active metrics menu, select Apigee environment API call count.
  3. Click Apply.
  4. In the Filters section:
    1. Use the Group By menu to group by resource label. Select proxy_deployment_type from the list options to group by Environment type.
    2. Click OK to apply the filters.
  5. Select Sum from the Grouping function menu.

MQL

To view Standard and Extensible API calls by environment with an MQL query:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the toolbar of the Select a metric pane, select Code Editor.
  3. To use MQL:
    1. Select MQL in the Language toggle.
    2. Enter the following query into the query editor:
      fetch apigee.googleapis.com/Environment
      | metric 'apigee.googleapis.com/environment/api_call_count'
      | delta(1m)
      | group_by [metric.proxy_deployment_type, resource.env, resource.location]

PromQL

To view Standard and Extensible API calls by environment with a PromQL query:

  1. Open the Monitoring > Metrics Explorer page in the Google Cloud console.

    Go to Metrics Explorer

  2. In the toolbar of the Select a metric pane, select Code Editor.
  3. To use PromQL:
    1. Select PromQL in the Language toggle.
    2. Enter the following query into the query editor:
      sum(delta(apigee_googleapis_com:environment_api_call_countmonitored_resource="apigee.googleapis.com/Environment"}[1m])) by (proxy_deployment_type,env,location)

Create a metrics dashboard

The graphical output of the Metrics Explorer on the Chart tab represents a gauge metric. That is, each point on the graph records the resource utilization of your Apigee instance across all environments in each region at the time of measurement.

Once you have configured your view of the data using the Resource & Metric selection, you can save the data to a custom dashboard for future reference. To save your selected view:

  1. Click the Save Chart button in the chart pane of the Explorer tab.
  2. In the Save Chart Dialog, enter the following information:
    • Chart title field: Enter a name for the chart, or use the suggested title.
    • Dashboard drop-down: Select an existing dashboard or select New Dashboard to create and name a new dashboard. Your chart will be saved to the selected dashboard.
  3. Click Save.

Once saved, you can access your chart by navigating to the Dashboards Overview page in the Google Cloud console and viewing the dashboard you selected.

To learn more about creating and managing custom views using Cloud Monitoring, see Dashboards and charts.

Configure a Cloud Monitoring alert

Once you have configured metrics reporting for your Apigee resource usage in Cloud Monitoring, you can enable metric-based alerting policies. You can configure alerting policies to monitor resource usage relevant to your Pay-as-you-go plan and provide timely awareness of any potential problems. For more information, see How alerting works.

You can add a metric-based alerting policy to your Google Cloud project by using the Google Cloud console, the Cloud Monitoring API, or the Google Cloud CLI. When you use the Google Cloud console, you can enable recommended alerts or configure custom alerts from the Alerting page of Cloud Monitoring.

The general steps required to create a metric-based alerting policy are outlined in Create metric-threshold alerting policies. To configure an alerting policy specifically based on resource usage, you can follow the steps in Create alerting policy.

You can use the same metrics and filters used in the previous section to customize your alert for resource usage. For example, to create an alert based on Apigee proxy usage, use the following steps:

  1. Open the Monitoring > Alerting page in the Google Cloud console.

    Go to Alerting

  2. Click + Create policy.
  3. In the Select a metric section of the Create policy pane, enter Apigee in the filter bar, and then use the submenus to select the resource type, category, and metric:
    • In the Active resources menu, select Apigee proxy (v2).
    • In the Active metric categories menu, select Proxyv2.
    • In the Active metrics menu, select Apigee proxy details.
  4. In the Add Filters section, use the Group By menu to group by resource label. Select both proxy_deployment_type and env from the list options to group by proxy deployment type and environment.

To create an alert based on Apigee active environment usage, select the metrics and filters used to View Apigee environment usage.

View resource usage by billing account

To view resource usage by billing account, follow these steps:

  1. Open the Billing page in the Google Cloud console.

    Go to Billing

  2. If you have more than one billing account, select Go to linked billing account to view the current project's billing account. To locate a different billing account, select Manage billing accounts and choose the account you'd like to view.
  3. Select Reports.
  4. Click Show Filters to access the Filters menu if it is not already open.
  5. In the Time range field, select Usage date to view a current snapshot of billing in a date range, or select Invoice month to view usage billed in a specific invoice.
  6. Select Group By > SKU.
  7. From the Services drop-down list, select Apigee. The list of SKUs included in your bill is displayed.
  8. To filter the list of SKUs, select the SKUs you want to view from the SKUs drop-down list.

    If your usage of any of these SKUs is 0, they will not appear in the Group By > SKU pull-down menu.

Monitor resource usage with Cloud Audit Logging

You can use Cloud audit logs to monitor resource usage that will affect your Pay-as-you-go billing. Follow these steps to view the relevant audit logs:

  1. Open the Logs Explorer page in the Cloud console.

    Go to Logs Explorer

  2. On the Query, use the Search bar to search for any events impacting the following billable resources:
    • Create instance with attached environment(s): google.cloud.apigee.v1.InstanceService.CreateInstanceAndAttachments
    • Update instance and it's attachments: google.cloud.apigee.v1.InstanceService.UpdateInstanceAndAttachments
    • Delete instance with attached environment(s): google.cloud.apigee.v1.InstanceService.DeleteInstance
    • Create instance attachment: google.cloud.apigee.v1.InstanceAttachmentService.CreateInstanceAttachment
    • Delete instance attachment: google.cloud.apigee.v1.InstanceAttachmentService.DeleteInstanceAttachment
    • Deploy a proxy: google.cloud.apigee.v1.DeploymentService.DeployApiProxy
    • Undeploy a proxy: google.cloud.apigee.v1.DeploymentService.UndeployApiProxy
    • Deploy a shared flow: google.cloud.apigee.v1.DeploymentService.DeploySharedFlow
    • Undeploy a shared flow: google.cloud.apigee.v1.DeploymentService.UndeploySharedFlow
    • Enable/disable the Apigee API Analytics or Advanced API Security add-on: google.cloud.apigee.v1.EnvironmentAddons.SetAddonEnablement

    For example, you could enter the following sample query:

    resource.type="audited_resource"
    resource.labels.method="google.cloud.apigee.v1.InstanceService.CreateInstanceAndAttachments"
    resource.labels.service="apigee.googleapis.com"

    For more information on using Cloud Audit Logging to monitor Apigee resources, see Apigee audit logging information.