App Optimize API overview

Understand your Google Cloud spending and resource usage with App Optimize API. For developers and administrators, this API offers a programmatic way to fetch detailed cost and utilization data so that they can incorporate this information into their team's dashboards, tools, and daily workflows.

The API returns data in a structured, tabular format, similar to the results of a SQL query, making it straightforward to parse and ingest into other systems.

Why use App Optimize API?

You can export reports for projects and App Hub applications for trend analysis or to join with other business data. You might also use this API to power internal dashboards, drive custom alerting systems, or build checks for costs and utilization into your deployment pipelines.

These integrations help administrators and application developers make data-driven, cost-aware decisions throughout the software lifecycle.

Integrate with analysis tools

A primary use case is automating the regular export of cost and utilization data to an analysis tool. By setting up a scheduled job using Cloud Run and Cloud Scheduler, you can call the API daily to fetch the latest data.

Power custom dashboards

The API can also power custom internal dashboards. Instead of being limited to prebuilt console views, your teams can build web applications that lazy-load specific cost and utilization metrics on demand. Using JavaScript, the dashboard can call the API and remain responsive while data is fetched in the background. This provides a tailored view of cost and efficiency data embedded directly into your team's workflows.

Enable data-driven decisions

By integrating App Optimize API into your systems, you gain flexible and automated access to the data needed for effective cloud financial management and resource optimization. These programmatic access patterns help you to answer critical cost-efficiency questions. You can identify services with a recent spike in costs, find underutilized resources, calculate the precise cost of a particular application within a specific timeframe, or monitor spending trends across different products and regions.

Key features

App Optimize API includes the following key features:

  • Detailed reporting. Generate reports that aggregate data across various dimensions, including project, individual resource, SKU, timeframe, and App Hub application, service, and workload.
  • Cost and utilization data. Access a range of information such as monetary cost, CPU utilization (mean and 95th percentile), CPU core usage and allocation, memory utilization (mean and 95th percentile), and memory usage and allocation.
  • Flexible filtering. Use the Common Expression Language (CEL) to precisely filter the data included in your reports. You can filter based on time ranges, resource types, specific App Hub applications, and other available attributes to focus your analysis.

Understand the data

The reports generated by App Optimize API provide valuable insights, but it's important to understand the nature and limitations of the data:

Cost data

  • Source: Cost data is based on the same information that powers your Cloud Billing reports and exports.
  • Latency: Google Cloud products report usage and cost data to Cloud Billing processes at varying intervals. You might see a delay between your use of Google Cloud services and when the usage and costs are available in App Optimize API reports. Typically, costs are available within a day, but this can sometimes take more than 24 hours.
  • Gross costs: The costs shown are generally gross costs, reflecting usage at your contract prices before any credits, such as Committed Use Discounts, sustained use discounts, or promotional credits, are applied.
  • Currency: When scoping by an App Hub application, all underlying resources within that application must use the same currency for costs to be aggregated. If resources are linked to billing accounts with different currencies, cost data for that application might be incomplete or not return.
  • Separately-reported costs: Data transfer and Persistent Disk costs are reported separately from resource-level costs for products that have data transfer or Persistent Disk charges.
  • Availability: The maximum time range for a report filter is 90 days before the current date. The start time must be within the 90-day time window.
  • Product categories: The product names used in App Optimize API reports are designed to be logical and user-friendly. These might group costs differently than the service categories used within Cloud Billing reports. For example, costs for "Compute Engine" in a App Optimize API report might encompass multiple underlying services from a Cloud Billing perspective.

Utilization data

  • Source: Utilization metrics are sourced from Cloud Monitoring.
  • Availability:
    • The maximum time range for a report filter is 90 days before the current date. The start time must be within the 90-day time window. Cloud Run metrics are only available for six weeks before the current date.
    • Availability depends on the resource type and whether the appropriate agents (like the Ops Agent) are configured to collect detailed metrics.

How App Optimize API works

The process for generating cost and usage reports has three main stages:

  1. Request a report. You specify the data you're interested in, including the time range, the resources or applications to cover, how to group the data, and the specific cost and usage details you want. After a report is created, its definition cannot be modified. If you need to change parameters, you must create a new report.
  2. Wait for the data to be prepared. Because gathering and organizing the data can take time, this step runs asynchronously. The API provides a way to check when your report is ready.
  3. Retrieve the report data. Once processing is finished, you can download the report, which is formatted in rows and columns based on your request.

Generated reports are automatically deleted from the API after 24 hours.

Pricing

During Preview, there is no additional cost for using App Optimize API, including creating reports, reading reports, and reading report metadata.

For information about costs that are associated with Google Cloud services that provide data to App Optimize API, refer to the following information:

What's next