Custom metrics allows customers to calculate metrics based on existing attributions within the CMP. Often when reporting on cost and usage for cloud environments the dimensions and metrics in your bill are not sufficient to understand key information. By creating formulas with portions of the bill key indicators of performance can be surfaced more cleanly.
Percentage of GCP CUD utilized
CUD (committed use discount) Usage / CUD (committed use discount) Commitment
Amortized Instance Reservation Consumption
Monthly Ec2 Instance type usage / (1 yr Reserved Instance type commitment / 12)
Percentage Shared Infrastructure Cost
Shared Infrastructure costs / Total Infrastructure Cost
Custom metrics can be particularly useful when tracking consumption of shared services. Determine what percentage of shared infrastructure is being used by a single app. Determine distribution of compute types across a set of accounts or projects.
Structure of a Metric
Custom metrics are created by creating formula's with Attributions. Each Attribution must have a base metric selected for it. This can either be: Cost, Usage, or Savings.
For instance, if you want to create a metric to track the percentage consumption of a compute commitment, you will require two attributions:
- Compute Usage
- Compute Consumption
You must create these attributions before you creating a custom metric.
Create a Metric
Select Analytics from the top menu bar, then select Metrics to access your custom metrics:
To create a new metric, select the New Metric button to access the New Metric screen:
- Name the new custom metric by selecting the Untitled metric text
- Configure the Base Metric and Attributions by selecting the input and choosing values from the drop-down menus
As you configure each metric, a new row (named A, B, C, and so on) will be added to the form so that you can continue continue to add more attributions.
Create a formula to generate the metric desired (see below).
Formulas support standard Order of Operations
Custom metric formulas support the following operators:
|()||Parentheses for grouping|
When a valid formula is created it will be automatically saved.
A formula is considered invalid if it is:
- Invalid Variable Definition
- Attribution and/or base metric provide no data
- Variable is not complete (no metric selected, no attribution selected)
- Invalid Formula
- Yields an error
- Divide by zero
- Incorrect formatting
When a valid formula is complete, a preview of the metric will be generated.
Including Customer Metrics in Cloud Analytics reports
To include a metric in a report, create a new report.
In the report configuration panel on the left-hand side, select your metric from the Custom Metrics section at the bottom of the drop-down menu.
Once selected you will be prompted to confirm your choice
After confirming your choice, you can build your report as usual with the addition of your custom attributions.