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:
- View resource usage in Metrics Explorer
- Configure a Cloud Monitoring alert
- View resource usage by billing account
- Monitor resources with Cloud Audit Logging
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:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- 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:
- In the Active resources menu, select Apigee proxy.
- In the Active metric categories menu, select Proxy.
- In the Active metrics menu, select Apigee proxy details.
- Click Apply.
- In the Filters section:
- Use the Group By menu to group by resource label. Select both
proxy_deployment_type
andenv
from the list options to group by proxy deployment type and environment. - Click OK to apply the filters.
- Use the Group By menu to group by resource label. Select both
- Select Count from the Grouping function menu.
MQL
To view Apigee proxy/shared flow deployment unit usage with an MQL query:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- In the toolbar of the Select a metric pane, select Code Editor.
- To use MQL:
- Select MQL in the Language toggle.
- Enter the following query into the query editor:
fetch apigee.googleapis.com/Proxy | metric 'apigee.googleapis.com/proxy/details' | group_by [metric.proxy_deployment_type, resource.env]
PromQL
To view Apigee proxy/shared flow deployment unit usage with a PromQL query:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- In the toolbar of the Select a metric pane, select Code Editor.
- To use PromQL:
- Select PromQL in the Language toggle.
- Enter the following query into the query editor:
count(apigee_googleapis_com:proxy_details{monitored_resource="apigee.googleapis.com/Proxy"}) 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:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- 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:
- In the Active resources menu, select Apigee environment.
- In the Active metric categories menu, select Environment.
- In the Active metrics menu, select Apigee active environment.
- Click Apply.
- In the Filters section:
- Use the Group By menu to group by resource label. Select
type
from the list options to group by environment type. - Click OK to apply the filters.
- Use the Group By menu to group by resource label. Select
- Select Count from the Grouping function menu.
MQL
To view Apigee active environment usage with an MQL query:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- In the toolbar of the Select a metric pane, select Code Editor.
- To use MQL:
- Select MQL in the Language toggle.
- 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:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- In the toolbar of the Select a metric pane, select Code Editor.
- To use PromQL:
- Select PromQL in the Language toggle.
- 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:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- 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:
- In the Active resources menu, select Apigee environment.
- In the Active metric categories menu, select Environment.
- In the Active metrics menu, select Apigee environment API call count.
- Click Apply.
- In the Filters section:
- Use the Group By menu to group by resource label. Select
proxy_deployment_type
from the list options to group by Environment type. - Click OK to apply the filters.
- Use the Group By menu to group by resource label. Select
- Select Sum from the Grouping function menu.
MQL
To view Standard and Extensible API calls by environment with an MQL query:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- In the toolbar of the Select a metric pane, select Code Editor.
- To use MQL:
- Select MQL in the Language toggle.
- 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:
- Open the Monitoring > Metrics Explorer page in the Google Cloud console.
- In the toolbar of the Select a metric pane, select Code Editor.
- To use PromQL:
- Select PromQL in the Language toggle.
- 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:
- Click the Save Chart button in the chart pane of the Explorer tab.
- 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.
- 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:
- Open the Monitoring > Alerting page in the Google Cloud console.
- Click + Create policy.
- 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.
- In the Active metric categories menu, select Proxy.
- In the Active metrics menu, select Apigee proxy details.
- In the Add Filters section, use the Group By menu
to group by resource label. Select both
proxy_deployment_type
andenv
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:
- Open the Billing page in the Google Cloud console.
- 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.
- Select Reports.
- Click Show Filters to access the Filters menu if it is not already open.
- 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.
- Select Group By > SKU.
- From the Services drop-down list, select Apigee. The list of SKUs included in your bill is displayed.
- 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:
- Open the Logs Explorer page in the Cloud console.
- 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.
- Create instance with attached environment(s):