Custom Labels
Custom Labels Overview
How are custom labels useful:
Your organization might have business reasons which require that you slice and dice the data in a specific way. This is hard to do because your raw cloud billing data might not have the appropriate tags that you need. Custom labels allows you to label the billing data to:
- Define the essential functional relationships between different parts of the business
- Tie cloud assets and their associated costs to business operations
This then gives you the ability to see costs in terms of how you actually run your business.
Here you can Create New Custom Label:
Once you click that, you’ll see a pop up appear:
Let’s walk through what each of the fields mean:
Existing Label Key
These are the labels that are in the billing export that are available to you. The labels that are available to you are:
- Systems Labels
- Project Labels
- Resource Labels
- Project IDs
- Billing Account IDs
Note: At this stage, you need to type in your label exactly as it appears in your billing export. Otherwise it won’t recognize the key.
To differentiate between system-, project- and resource-labels that exist natively in the billing export, Ternary has prefixed the additional labels with "ternary.app/".
Existing Label Value
These are simply all the values that are associated with a ‘key’ that you select from any of the above categories of labels available to you.
New Custom Label Key
This the new key or category you wish to create. Simply type in the key name that you would like.
Custom Label keys must satisfy the following criteria:
-
start with a lowercase letter
-
be composed of only lowercase letters (international allowed), numbers or characters: _ - . /
-
be sixty-four characters in length or shorter
-
for a given Custom Label, all keys must be unique (no duplicates)
-
may not start with "ternary.app/" as this prefix is reserved by Ternary
In addition to these rules, the number of unique Custom Label keys must be no larger than 100 across all Clouds.
New Custom Label Value
This is the label that’s associated with the new key that you just created.
Custom Label values must satisfy the following criteria:
-
be composed of only lowercase letters (international allowed), numbers characters: _ - . /
-
be sixty-four characters in length or shorter
What the logic is saying:
The logic is basically saying this:
If {EXISTING KEY} equals one of {EXISTING LABEL VALUES} THEN assign this {NEW KEY} with this {NEW LABEL VALUE}.
Let’s walk through an example to see how this would work in practice.
Let’s say you you have the following project IDs:
- Gcp-project-prod-1
- Gcp-project-prod-2
- Gcp-project-prod-3
- Gcp-project-prod-4
You want to roll up these projects in the following way:
- Project 1,2,3 belong to Cost Center: Cost of Revenue
- Project 4 belongs to Cost Center: Special Test
- All the projects are in development environment: Prod
You would like to see what is the cost for:
- Each Cost Center
- The total cost of everything that’s Prod related
Here you would apply the labels in the following manner:
- Step 1:
- Pick Existing Label Key: Project ID (this is the key that you want to roll up)
- Step 2: Pick all the projects that are associated with the cost center: Cost of Revenue Label (in this case Projects 1,2,3)
- Step 3: In Custom Labels Section. Create a New Custom Key “Cost_Center”
- Step 4: In Custom Labels Sections. Assign Value “Cost_of_Revenue’
Now, since projects 1,2,3 ALSO belong to dev environment: Prod, you should also:
- Step 5: In Custom Labels Section. Create a New Custom Key “dev_environment”
- Step 6: In Custom Labels Sections. Assign Value “prod’
This is what your output would look like:
Once you click ‘Submit’, you’ll see the rule in the existing set of rules.
Now you need to do the same with the remaining project:
Once you’ve created a label, it can then be used to filter different data views within Ternary. For instance, let’s say you go to the home page, and you want to see costs associated with a specific set of labels that you’ve created. You can use the consumer side custom labels feature to apply the filter to the data on the Home Page.
There also is functionality to edit or delete labels rules that you’ve created.
Operators:
There are three different operators available to support matching label values of different types.
"equals" - Match the exact string.
"fuzzy_equals" - Like equals, but the asterisk character * will match any sequence of any characters.
"regex_matches" - Matches if and only if the input string contains a match for the input regex pattern.
As of 7 Oct 2021, the UI only supports the "equals" operator, but the remaining operators are available via API.
Table-based Custom Labels
Ternary's Custom Labels let users express complex rules to re-tag cost or usage based on original label or column values ingested from the cloud provider. However, these mappings can quickly balloon in number. Take for example a company with hundreds of AWS accounts, each belonging to a specific engineering team. Although each individual mapping is simple (e.g. if account_id
equals "123456789", then add a label "team=foobar"`), when these mappings are many, they can become difficult to manage in the Ternary Custom Labels UI.
With table-based Custom Labels, a user may efficiently onboard and maintain a large number of labels by configuring Ternary to reference a BigQuery table for custom label definitions. The following shows the table contents a user might integrate in order to create table-based custom labels, keyed on account_id, making it possible to group spend by cost_center and account owner.
Each row could have been implemented as a single custom label created in the UI, but the table-based Custom Label is an effective alternative to create and manage the custom labels in bulk.
account_id | cost_center | owner |
---|---|---|
0000000001 | 50000 | [email protected] |
0000000002 | 50001 | [email protected] |
0000000003 | 50002 | [email protected] |
0000000004 | 50003 | [email protected] |
0000000005 | 50004 | [email protected] |
0000000006 | 50005 | [email protected] |
0000000007 | 50006 | [email protected] |
0000000008 | 50007 | [email protected] |
Consult our API documentation or create a Ternary Customer Success ticket (Click 'Help' in Ternary) to learn more about using TBCLs to categorize your spend at scale.
Custom Groupings
Our Custom Groupings functionality allows you to create a new grouping with 2 or more existing vendor labels. This can be used for things like resolving misspellings of labels (ie; environment, enviornment, env,) into a single grouping or changing a set of labels into a single grouping.
Adding a new grouping
Click the "New Grouping" icon -> Row #1 will be created -> Add a Group Name (for example, Environment) -> Select the Labels you want to include in the new Grouping -> Click Submit -> You will receive an "Operation Successful! The custom grouping has been successfully created" once complete
Using your new Custom Grouping in TRE
Once you have created 1 or more Custom Groupings. You can now use these custom groupings in the Ternary Reporting Engine.
Updated about 19 hours ago