# Relational Virtual Tags

## **Overview**

Relational Virtual Tag enables the breakdown of shared infrastructure costs across multiple dimensions from a single telemetry while preserving the relationships between them.&#x20;

Imagine your company is managing cloud costs through Finout’s MegaBill. The company uses various shared infrastructures, such as Airflow, which runs on shared cloud instances and runs tasks which can serve multiple teams, applications and workflows. Since resources like EC2 instances are not tied to a single team or workflow, accurately allocating costs becomes challenging.

With Relational Virtual Tags, you can establish connections between multiple attributes—such as Airflow's DAG ID, Team, and Environment—ensuring that costs are properly allocated while maintaining the relationships between these attributes. This advanced tagging method provides deeper insights into shared infrastructure usage and cost allocation.

## Challenges and Solutions

#### **Let's start with a simple story...**

Meet the Miller family. They track their household expenses and bills meticulously, and electricity usage is no exception. Mike relies on Finout’s MegaBill to monitor costs and consumption, which provides him with the family’s total electricity bill and usage.&#x20;

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FjDCSSZiDxB0O7Bk1CH5z%2Fimage.png?alt=media&#x26;token=07ba0b51-175a-4387-b019-2485462e84c8" alt="" width="447"><figcaption></figcaption></figure>

One day, he noticed that their electricity costs were steadily increasing, even though their consumption habits hadn’t noticeably changed. Curious to uncover the cause, Mike began digging deeper into the data.

**Electricity Usage per Room**

Mike set up a telemetry and used Virtual Tag Reallocation to break down electricity usage by room. The results were revealing as the kitchen was the biggest consumer of electricity.

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FyXkMgq37XRGZxnXjtllW%2Fimage.png?alt=media&#x26;token=00b75ac5-2c5a-4746-84ac-6cc87cdab87c" alt=""><figcaption></figcaption></figure>

**Electricity Usage per Device in the Kitchen**&#x20;

This information was insufficient to pinpoint the root cause of the high costs. Mike decided to analyze the electricity consumption of each kitchen appliance. His findings showed that the dishwasher was the biggest consumer of electricity.

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FefvJ7PrnjSl104ZimiMW%2Fimage.png?alt=media&#x26;token=095febff-ae26-4f60-9af7-7332816bd5dc" alt="" width="540"><figcaption></figcaption></figure>

**Electricity Usage for the Dishwasher per Household Member**

This was still not enough to pinpoint what caused the spike in the dishwasher's electric cost.\
He installed a motion sensor to monitor the household members’ interactions with the dishwasher and integrated this new data into his analysis.  The results were surprising as Olivia, his daughter, was responsible for the highest dishwasher usage.<br>

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FycdUC1ToLFHFM1imYkXQ%2Fimage.png?alt=media&#x26;token=2c5d3e71-39e7-4373-81f0-93a3c38091f6" alt=""><figcaption></figcaption></figure>

This family's story reflects the challenges companies face when trying to break down shared cloud infrastructure costs across multiple dimensions. It highlights how deeper data analysis and segmentation can reveal hidden cost drivers.&#x20;

**What is the Challenge with Virtual Tag Reallocation?**

* **Complex and Manual Process:**\
  Breaking down costs across multiple dimensions is possible today, but it requires a lot of manual effort. Users must create multiple virtual tags, starting from the lowest level (Household Member → Device → Room).
* **Virtual Tag Reallocation cannot preserve relationships between dimensions:**
  * You *can* determine electricity usage by device.&#x20;
  * You *can* determine electricity usage by household member.
  * But *you can’t* determine the electricity usage of each device by each household member.\
    \
    **For Example:** \
    Let's assume that the dishwasher's electricity cost is $40. \
    Breaking it down by household member would assign random costs because regular virtual tags lack the ability to preserve the relationship between the device (the dishwasher) and its usage by each household member, making it difficult to identify the precise sources of cost discrepancies.

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FAjXsAKoGYJXKQNASiB9o%2Fimage.png?alt=media&#x26;token=73334702-bf41-4eb5-9ac6-b560a103784d" alt=""><figcaption></figcaption></figure>

#### Let's talk about cloud...

Imagine a company is using AWS to manage its cloud costs through Finout’s MegaBill. This company relies on a shared infrastructure, such as **Airflow**, which operates on cloud instances (like EC2 in AWS) to manage tasks, run DAGs, and store metadata.&#x20;

Airflow, like Mike’s electricity bill, is a shared resource that requires careful allocation across multiple workflows (DAGs), teams, and developers. The challenge lies in accurately breaking down and reallocating these shared infrastructure costs.&#x20;

One day, the company noticed an increase in Airflow costs and needed to pinpoint the source, just as Mike used data to understand the drivers of his electricity usage.

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FMljxkM6kpbKLYxMdGOcu%2Fimage.png?alt=media&#x26;token=fb376ca5-3472-468f-a9fe-181cffeb8c2e" alt=""><figcaption></figcaption></figure>

**This is where the Relational Virtual Tag solution comes in!**

Relational Virtual Tags Enables:

* **Streamlined Setup and Efficiency:**\
  Relational Virtual Tags replace the manual creation of multiple virtual tags with a single, unified configuration that uses one telemetry to build all the necessary building blocks to break down a shared infrastructure cost.
* **Dynamic Cost Allocation and Relationship Preservation:**\
  Relational Virtual Tags maintain relationships between dimensions (e.g., team, workflow, developer) and enable dynamic, proportional cost reallocation. This prevents inaccurate cost assignments, improves financial transparency, and provides deeper insights for more informed decision-making and better cost management.

**For example:**\
The company has two teams - "Data" and "App".&#x20;

The company wants to determine the cost of each DAG for the App team. They aim to break down the total cost of the App team by DAG ID for better visibility and allocation.

This is the company's telemetry:

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FJYBKkmaaZNa86J09JWno%2Fimage.png?alt=media&#x26;token=22ddbf76-1072-4e45-a97b-74eb4192c837" alt=""><figcaption></figcaption></figure>

The company created a relational virtual tag, and now they filter by team “App” and group by “DAG\_ID.”&#x20;

Let’s assume that the App team cost is $100. The breakdown would be as follows:

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FzguW9yhUxHfhOD7unLld%2Fimage.png?alt=media&#x26;token=d8d69071-695f-4f79-82ee-88add0922a83" alt="" width="434"><figcaption></figcaption></figure>

By leveraging Relational Virtual Tags, the company transformed a seemingly unmanageable rise in shared infrastructure costs into clear, actionable data. This deeper level of visibility empowered the company to identify inefficiencies, distribute costs fairly across teams, and optimize their use of shared resources—just as Mike did with his electricity bill.

## Use Cases

#### **Spark: Break Down Costs by Query and Project**

Spark costs are often lumped together in shared infrastructure, making attributing expenses to **specific queries** or **projects** difficult. Without proper tracking, teams struggle to pinpoint cost drivers. **Relational Virtual Tags** solve this by linking queries to projects, enabling precise cost reallocation.

***

#### **RDS: Break Down Costs by Database Name, Environment, and Team**

RDS instances are shared across multiple **databases**, **environments**, and **teams**, making it hard to distribute costs accurately. Without visibility, production, staging, and development usage may be misallocated. **Relational Virtual Tags** create structured relationships, ensuring fair cost distribution across Database Names, Environments, and Teams.

***

#### **ClickHouse: Break Down Costs by Query Type, Cluster, and Application**

ClickHouse workloads are distributed across multiple **query types**, **clusters**, and **applications**, making it challenging to track and allocate costs accurately. Without a structured breakdown, teams struggle to optimize resource usage and manage expenses efficiently. **Relational Virtual Tags** preserve the relationships between these dimensions, ensuring cost allocation across Query Type, Cluster, and Application.

## Create a Relational Virtual Tag

{% hint style="success" %}
**Prerequisite**: A telemetry must be set up before Relational Virtual Tag configuration.
{% endhint %}

**To create a relational virtual tag:**

1. In Finout, navigate to **Virtual Tags**.<br>

   <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2F1amTjbFmIMm6BK5FSTn9%2Fimage.png?alt=media&#x26;token=ef9d593f-aa5b-47af-a6bf-c292c892c353" alt=""><figcaption></figcaption></figure>
2. Click **Create New** and then **Relational Virtual Tag**.\
   The **Create Relational Virtual Tag** step appears.<br>

   <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FnQlB7USuLUMwFvYQXHpg%2Fimage.png?alt=media&#x26;token=7dfbc902-3b7a-460d-9738-69c27ed88fd3" alt=""><figcaption></figcaption></figure>
3. Add a name.<br>

   <div align="left"><figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2F1RWlPfUIpYPqERWrXeLj%2Fimage.png?alt=media&#x26;token=6847a17a-4001-46d5-9218-14ed271b35b3" alt=""><figcaption></figcaption></figure></div>
4. Under **Cost Filter Selection**, select from the following:<br>

   <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FKvUPQKKVrAiKTORTlwGc%2Fimage.png?alt=media&#x26;token=2e1d61cf-25ec-4afb-b88f-426648ec97f8" alt=""><figcaption></figcaption></figure>

   1. **Cloud service:**\
      ![](https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FdSic0LidNbxN6M0Suz4K%2Fimage.png?alt=media\&token=853568f2-b70c-4166-abbf-b17bfac2b190)<br>
   2. **Key type:**<br>

      <div align="left"><figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FsxdSRBvU2qb6tlf62NSo%2Fimage.png?alt=media&#x26;token=94ca8c6b-c471-42df-8605-37de161086b1" alt=""><figcaption></figcaption></figure></div>
   3. **Operator:**\
      ![](https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FZQpyKoUZcEEbwPH3Q0IM%2Fimage.png?alt=media\&token=a060ac86-09ac-49fe-aa10-16ee479b2d88)<br>
   4. **Values:**\
      ![](https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2F5d2U3dERz28xncBUbvh1%2Fimage.png?alt=media\&token=76b015c6-1d7b-4173-8da4-7e4f077ea1d7)<br>

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Note</strong>: Click <img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FO6R71nsW9hC3G1vvc4pj%2Fimage.png?alt=media&#x26;token=e4136118-9306-4ba8-b911-9df2a64353df" alt=""> to add another filter.</p></div>
5. Select your **Telemetry-Based Reallocation.**<br>

   <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FYaBIs8lARRjQs88IXsbw%2Fimage.png?alt=media&#x26;token=47112573-a869-4ef8-a119-4cea7924dfb1" alt=""><figcaption></figcaption></figure>

   1. **Select a Telemetry:**\
      ![](https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FI83kue1fR86dtOXfHzt0%2Fimage.png?alt=media\&token=4e454e3f-9b69-4d0c-b629-3e7cc5544370)
   2. **Pick the Allocation Keys:**\
      Choose the Allocation Keys from your selected telemetry. This will allow for the segmenting of the Telemetry data and the calculation of the relevant ratio based on the keys and values.<br>

      <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Note</strong>: Relational virtual tags support cost reallocation based on relationships across up to 10 keys.</p></div>

      <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FBndnv4FJsAbu5JLPgnKZ%2Fimage.png?alt=media&#x26;token=caebf3c0-90f7-4cd0-b239-f66791830547" alt=""><figcaption></figcaption></figure>
   3. **Select Telemetry filters:**<br>

      <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FwjErfP7e63CpobUu5pIB%2Fimage.png?alt=media&#x26;token=eea3d82e-39af-451c-8534-b68fe46d2f82" alt=""><figcaption></figcaption></figure>
6. **Preview** the Relational Virtual Tag.\
   You can simulate the graph preview by choosing a group-by and filters.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Note</strong>: By default, the first selected key is displayed in the preview, but this can be edited.</p></div>

   <br>

   <figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2F2udDTQjohOX9w0UGwWZ8%2Fimage.png?alt=media&#x26;token=66e90427-50fd-4bc0-805c-45c4ed7d0c4a" alt=""><figcaption></figcaption></figure>
7. Click **Save**.\
   The relational virtual tag is created.

**Result**: \
You can view your Relational Virtual Tag keys and values in the MegaBill filters component, just like any other keys and values.<br>

<div align="center"><figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FkBVLLe2wCRegww507MbV%2Fimage.png?alt=media&#x26;token=80dfec9c-2658-46ac-bebe-77f46ec9039c" alt=""><figcaption></figcaption></figure></div>

\
Let's go back to the [house and electricity bills example](#challenges-and-solutions). Here's how the Relational Virtual Tag configuration would be set up:

<figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FiW9uWxxBxrZOTYSHCYU4%2Fimage.png?alt=media&#x26;token=2ab5d434-dde6-46f7-972c-3a6a26e93362" alt=""><figcaption></figcaption></figure>

## Limitations

* When using Relational Virtual Tag keys or values in MegaBill or any Finout object, you can only filter or group by keys and values from the same Relational Virtual Tag or a connected Virtual Tag.
* A Relational Virtual Tag can handle up to 50,000 unique values, with any additional values automatically grouped under “Others.”
* You can create an unlimited number of relational virtual tags.&#x20;
* Each relational virtual tag can break down the cost of a single infrastructure (single cost rule).

## FAQs

**How is a Relational Virtual Tag different from a Virtual Tag with telemetry-based reallocation?**

Unlike Virtual Tag Reallocation, which allocates costs based on a single key from a single telemetry, Relational Virtual Tags support multiple key allocations (up to 10) while preserving the relationships between them.

**What happens if I try to group by a Relational Virtual Tag and an unrelated tag?**

Grouping by a Relational Virtual Tag while filtering by an unrelated tag (e.g., Airflow DAG ID with an AWS Region) is not supported.

**Can I create a Relational Virtual Tag via API?**

No, Relational Virtual Tags cannot be created through the Finout API.

**Is there a limit on the number of unique values a Relational Virtual Tag can handle?**

There is a limit: The system supports up to 50,000 unique values, with any additional values grouped under “Others.”

**Can I change a Virtual Tag and convert it to a Relational Virtual Tag?**

No, you need to create a new Relational Virtual Tag.
