Cost Allocation
The Dynatrace Cost Allocation function lets you allocate Dynatrace DPS usage and costs to your cost centers and products that utilize Dynatrace functionality. You can designate cost centers or products for cost allocation and associate those with the hosts, services, or users that utilize Dynatrace resources. This provides a transparent and detailed account of each cost center’s Dynatrace expenditure, helping your organization optimize its budgets.
The Dynatrace Cost Allocation feature incorporates two fields for cost centers and products. You can use either or both fields. These fields reflect your company's cost allocation structure, enabling you to develop two distinct perspectives: one based on your cost centers (for example, departments) and another based on your products or services (for example, Applicationname or ApplicationID). Of course, you can customize the use of these fields to fit your company's organizational framework.
Cost Allocation is not available for “early access” DPS licensing agreements signed prior to April 2023.
Supported DPS capabilities
Cost Allocation is exclusively available for Dynatrace SaaS environments with a Dynatrace Platform Subscription (DPS).
The table below outlines the supported capabilities and any known limitations.
For more details, see Monitoring consumption per capability.
* K8s pod-based cost allocation is not available in application-only container monitoring.
We're continuously extending Cost Allocation support to cover additional Dynatrace capabilities. For complete details regarding your licensing agreement, please contact your Dynatrace account manager.
Enrich host monitoring data for Cost Allocation
Introduction
This tutorial offers a step-by-step process for setting up your system to utilize Dynatrace Cost Allocation features. Upon completion, you'll have successfully prepared your Dynatrace SaaS environment for Cost Allocation and learned to adjust the settings as necessary.
What you'll learn
In this tutorial, you’ll learn how to:
- Configure the Cost Allocation allow list—the cost center or product values you want to accept within your system
- Configure the Cost Allocation assignments—for host monitoring via OneAgent or Kubernetes
- Generate cost reporting via the Account Management API—split by cost center or product
The allow list guarantees that Cost Allocation recognizes only those cost centers and products you have identified as valid. Any input in the Cost Allocation field that doesn't correspond with a predefined value is disregarded, with those costs not explicitly distributed. Usage associated with any other value is grouped under not allowlisted. Similarly, usage lacking a Cost Allocation designation is grouped under unallocated. The Cost Allocation allow list consists of two separate lists—one for the valid cost centers and one for the valid products.
Configure the allow list via Account Management UI
To add or remove fields from the allow list, go to Account Management > Subscription > Cost management.
In Cost Management, you'll find the Cost Allocation allow list configurations.
Note that the allow list might take some time to update, and changes are not retroactive. Removing a value from the Allow List won't affect past Cost Allocation data that used that value. You'll still be able to see the usage and costs associated with the removed value in the historical reports.
Configure the allow list via Account Management API and setup script
The Cost center allow list can be configured via the Account Management API. For details, see Dynatrace Platform Subscription API documentation.
OneAgent configuration: Assign cost centers and products
Via OneAgent configuration, the following DPS Capabilities can be set up for Cost Allocation in a Dynatrace SaaS environment.
* This configuration can be used whenever a OneAgent is deployed. It doesn’t matter if the OneAgent is deployed on physical hosts, K8s nods, K8s pods, or cloud servers.
For general OneAgent information, see OneAgent documentation.
Configure Cost Allocation fields on the host
Due to the needed OneAgent restart, we recommend that you set the host tag as OneAgent command-line parameters.
-
To add or change host tags, run the following command. For details, see Define tags and metadata for hosts.
Linux examples:
./oneagentctl --set-host-tag=dt.cost.costcenter=RnD
./oneagentctl --set-host-property=dt.cost.costcenter=RnD
Windows examples:
.\oneagentctl.exe --set-host-tag=dt.cost.product=AX
.\oneagentctl.exe --set-host-property=dt.cost.product=AX
-
Verify that properties are set.
./oneagentctl --get-host-tags
or./oneagentctl --get-host-properties
-
Restart OneAgent: For details, see Stop/restart OneAgent on Linux
Alternative procedure
Use the Deployment Status app within your environments.
-
In Dynatrace, go to Deployment Status.
-
In the OneAgents section:
- Select all OneAgent deployments you want to configure with the same value.
- Select the modify host properties action from the list in the lower-left corner.
- Select Run action.
If your host doesn’t show up, confirm that you deactivated Show new OneAgent deployments.
-
Add or modify
dt.cost.costcenter
ordt.cost.product
. -
Restart OneAgent. For details, see Stop/restart OneAgent on Linux.
Note that the host overview page doesn't show whether the OneAgent was restarted after editing a cost center field via the web UI. To avoid any potential misunderstandings, we strongly recommend using the command line option to set the host tag.
This is a OneAgent example script for configuring cost center and product Cost Allocation entries on a Linux or Windows host. It sets the Cost Allocation cost center to “engineering” and the Cost Allocation product to “shipping-center” via Dynatrace OneAgent.
# Below are commands for setting Cost Allocation tags on hosts.# Ensure that OneAgent version 1.291 or later is installed.# The listed commands must be executed with root rights.# The command parameters used below to set tags and properties can also be used during the OneAgent installation.# More details about using oneagentctl available at https://docs.dynatrace.com/docs/shortlink/oneagentctl# More details about setting tags and properties on hosts available at https://docs.dynatrace.com/docs/shortlink/tagging-hostautotag# LinuxCOSTCENTER=EngineeringPRODUCT=shipping-center/opt/dynatrace/oneagent/agent/tools/oneagentctl --set-host-tag=dt.cost.costcenter="${COSTCENTER}" --set-host-tag=dt.cost.product="${PRODUCT}" --restart-service# WindowsCOSTCENTER=EngineeringPRODUCT= shipping-center%PROGRAMFILES%\dynatrace\oneagent\agent\tools\oneagentctl.exe --set-host-tag=dt.cost.costcenter="${COSTCENTER}" --set-host-tag=dt.cost.product="${PRODUCT}" --restart-service
Removing Cost Allocation fields from a host’s OneAgent configuration
The dt.cost.costcenter
and dt.cost.product
values can be removed from the OneAgent configuration whenever necessary.
Note that the values for Cost Allocation fields of already recorded costs are not changed in this case.
The updated configuration will only be reflected in updated values after the rename is implemented. Modifications or removal of Cost Allocation fields take effect after a short period.
Run the following command to remove Cost Allocation host tags. For details, see Define tags and metadata for hosts.
-
Use oneagentctl to remove properties
Linux examples
./oneagentctl --remove-host-tag=dt.cost.costcenter=RnD
./oneagentctl --remove-host-property=dt.cost.costcenter=RnD
Windows examples
.\oneagentctl.exe --remove-host-tag=dt.cost.product=AX
.\oneagentctl.exe --remove-host-property=dt.cost.product=AX
-
Verify that the properties are removed:
./oneagentctl --get-host-tags or ./oneagentctl --get-host-properties
-
Restart OneAgent: For details, see Stop/Restart OneAgent on Linux
./oneagentctl --restart-service
This OneAgent example script removes cost center and product Cost Allocation entries on a Linux or Windows host. It deletes the previously set Cost Allocation cost center field with the value engineering and the Cost Allocation product field with the value shipping-center via Dynatrace OneAgent.
# Below are commands for setting Cost Allocation tags on hosts.# Ensure that OneAgent version 1.291 or later is installed.# The listed commands must be executed with root rights.# The command parameters used below to set tags and properties can also be used during the OneAgent installation.# More details about using the oneagentctl: https://docs.dynatrace.com/docs/shortlink/oneagentctl.# More details about setting tags and properties on hosts: https://docs.dynatrace.com/docs/shortlink/tagging-hostautotag.# LinuxCOSTCENTER=EngineeringPRODUCT=shipping-center/opt/dynatrace/oneagent/agent/tools/oneagentctl --remove-host-tag=dt.cost.costcenter="${COSTCENTER}" --remove-host-tag=dt.cost.product="${PRODUCT}" --restart-service# WindowsCOSTCENTER=EngineeringPRODUCT= shipping-center%PROGRAMFILES%\dynatrace\oneagent\agent\tools\oneagentctl.exe --remove-host-tag=dt.cost.costcenter="${COSTCENTER}" --remove-host-tag=dt.cost.product="${PRODUCT}" --restart-service
Changing Cost Allocation values in OneAgent configuration
The values for dt.cost.costcenter
and dt.cost.product
can be renamed or deleted. But there is no propagation to already recorded costs. This means the original value will persist for these costs, and the new value only starts to appear from when the renaming took effect. This is because past tracked consumption can't be changed. If the need arises to reassign past usage, this must done outside of the Dynatrace web UI based on the existing data export feature for Cost Allocation within the Account Management API.
See Extract Cost Allocation data via Account Management web UI for information on extracting Cost Allocation data.
Changing or deleting values takes a couple of minutes before going into effect. Please make sure the new values are also changed on the allow list.
Workarounds for unsupported capabilities
Digital Experience Monitoring Cost-Allocation workaround
For DPS consumption details, see built-in classic metrics. All DPS-related metrics have “DPS” in their name.
Real User Monitoring example
See Real User Monitoring classic metric documentation.
Query cost-allocation workaround
Until Dynatrace Cost Allocation is available, DQL query usage details can facilitate a workaround. For each DQL query, Dynatrace records the executing user and the calling application.
Relevant DQL queries can be found within Account Management > Subscription Overview.
Host-monitoring Cost-Allocation checklist
You’ve set everything but still can’t find your Cost Allocation data? Please follow this checklist, which guides you through a validation process.
-
In Account Management, select Subscription > Cost management and switch to the Cost allocation tab.
-
In another window, go to Infrastructure & Operations on your environment.
-
Check the tags on the configured host.
-
Now, side by side, compare the Cost Allocation tags on the host with the Cost Allocation allow list
- Is the tag name correct?
- Is the tag value included in the Cost Center or Product allow list (open page from the previous step)
-
Did you restart the OneAgent?
- When in doubt restart OneAgent. For details, see Stop/Restart OneAgent on Linux.
Best practices
Setting cost center fields (dt.cost.costcenter)
As a best practice for cost center fields, we recommend using the organizational level to which the costs belong. If the organizational unit also has a unique ID, we recommend using both the text-based name and the ID separated by ,
or /
as they can be split into separate columns after the export.
Example: I need to report monthly on what certain business units have consumed in the Dynatrace platform.
Host 1: dt.cost.costcenter = “Business Unit 1 / BU-ID”
Host 2: dt.cost.costcenter = “Business Unit 1 / BU-ID”
Host 3: dt.cost.costcenter = “Business Unit 2 / BU-ID”
Setting Product fields (dt.cost.product)
As a best practice for product fields, we recommend using the application or product group to which the costs belong. If the Application also has a unique ID, we recommend using both the text-based name and the ID separated by ,
or /
as they can be split into separate columns after the export.
Example: I need to report monthly what certain applications have consumed in Dynatrace.
Host 1: dt.cost.product = “Applicationname / AppID”
Host 2: dt.cost.product = “Applicationname / AppID”
Host 3: dt.cost.product = “Applicationname / AppID”
Handling shared costs
For a shared service (for example, a large host with Full-Stack Monitoring supporting multiple products), define a Cost Allocation value representing the shared group and allocate its costs outside Dynatrace.
Example: The Host “Omega” is utilized for both the “Webpage” and “Mobile App” products. It should be divided such that 40% is attributed to “Webpage” and 60% to “Mobile App”. To achieve this, host Omega is set up with dt.cost.product=”Webpage_MobileApp
.
Cost Allocation data and expenses are retrieved from Account Management, imported into an Excel or Power BI Board, and configured to allocate the costs between “Webpage” and “Mobile App” in the 40% to 60% ratio.
Retrieve and analyze Cost Allocation data
Introduction
In this tutorial, you'll learn how DPS licensing consumption is distributed among your organization’s various products or cost centers. You’ll discover how to retrieve reported Cost Allocation data—whether by exporting the data to an external reporting tool or utilizing our comprehensive set of Grail reporting capabilities.
What you'll learn
By the end of this tutorial, you'll be proficient in:
- Downloading your Cost Allocation data from Account Management
- Analyzing your Cost Allocation data from within your environments
This tutorial will help you make informed decisions about your budgeting, costs, and resource allocation strategies. Let's get started!
Extract Cost Allocation data via Account Management web UI
Your licensing consumption and related costs are calculated daily based on the details of your licensing agreement and rate card. Therefore, you won’t see costs for certain capabilities utilized within the past 24 hours. Nonetheless, your usage is reported once every 15 minutes.
A CSV file containing all Cost Allocation data of the current subscription can be exported from the Cost Management - Cost Allocation page.
Extract Cost Allocation data per Account via API
All Cost Allocation data can be retrieved via the Account Management API.
How to generate the Account Management API token
First, you need to generate an Account Management API token. For complete instructions, go to Authentication for the Account Management API. To retrieve Cost Allocation details, you’ll need the permission View usage and consumption: account-uac-read.
Documentation of the new Cost Allocation endpoint
The API endpoint provides cost and usage data based on Cost Allocation fields for the specified period. Costs and usage are calculated once every 24 hours. Depending on the selected time period, only usage data might be available.
Further details can be found here in Account Management API documentation.
#Retrieve cost and usage details by cost center or product for a specific environmentGET /v1/subscriptions/{subscription-uuid}/cost-allocation?field={field}\&environment-id={environment-id}
Parameters
Response: Paginated list of daily costs per capability and field.
Sample response
{"records": [{ "date": "2024-04-01", "capability": "FULLSTACK_MONITORING","key": "department-A", "costs": 10, "usage": 2000 },{ "date": "2024-04-01", "capability": "FULLSTACK_MONITORING","key": "department-B", "costs": 40, "usage": 8000 },{ "date": "2024-04-01", "capability": "LOGS", "key": "department-A", "costs": 70, "usage": 700 },{ "date": "2024-04-01", "capability": "LOGS", "key": "department-B", "costs": 20, "usage": 200 },{ "date": "2024-04-01", "capability": "FULLSTACK_MONITORING", "key": "department-E", "costs": 10, "usage": 2000 },{ "date": "2024-04-01", "capability": "FULLSTACK_MONITORING", "key": "department-F", "costs": 50, "usage": 10000 },{ "date": "2024-04-01", "capability": "FULLSTACK_MONITORING", "key": null, "costs": 60, "usage": 12000 },{ "date": "2024-04-01", "capability": "LOGS", "key": null, "costs": 10, "usage": 100 },{ "date": "2024-04-02", "capability": "FULLSTACK_MONITORING", "key": "department-A", "costs": 10, "usage": 2000 },{ "date": "2024-04-02", "capability": "FULLSTACK_MONITORING", "key": "department-B", "costs": 40, "usage": 8000 },{ "date": "2024-04-02", "capability": "FULLSTACK_MONITORING", "key": "department-C", "costs": 70, "usage": 14000 },{ "date": "2024-04-02", "capability": "LOGS", "key": null, "costs": 500, "usage": 5000 }// more daily records],"nextPageKey": "...","environmentId": "tenant-A","field": "COSTCENTER"}
Analyze Cost Allocation data within the Account Management UI
A dedicated Cost Allocation web UI for Account Management is not yet available. Please export Cost Allocation data to an external reporting tool or analyze license consumption at the environment level using environment-specific dashboards.
Analyze Cost Allocation data within the Environment UI with Dashboards
The related Cost Allocation data is stored in Grail as billing usage events within each environment. Billing usage events can be analyzed using Dynatrace platform tools like Dashboards and Notebooks. Below, you'll find several Dynatrace Query Language (DQL) examples. For additional examples, refer to our DPS Cost Allocation usage & costs Dashboard. The DPS Cost Allocation usage & costs Dashboard can be found on the Dynatrace Playground.
From there, you can download the dashboard and upload it in any environment of your choosing.
For details on DQL syntax, see the DQL Documentation.
Remember that licensing consumption calculations are performed once every 24 hours, so you might not see the costs for certain capabilities that were used recently. Nonetheless, your usage is reported every 15 minutes.
Fetch all Billing Usage Events in full detail (including Cost Allocation fields).
fetch dt.system.events| filter event.kind == "BILLING_USAGE_EVENT"
Fetch all Billing Usage Events for all supported host-related capabilities and show only their capability, Host ID, and Cost Allocation fields
fetch dt.system.events| filter event.kind == "BILLING_USAGE_EVENT"| fieldsKeep event.type, dt.entitiy.host, dt.cost.costcenter, dt.cost.product
Check if any Cost Allocation fields are already configured.
fetch dt.system.events| filter event.kind == "BILLING_USAGE_EVENT"| summarize count = count(), by:{event.type,dt.cost.costcenter}
The Cost Allocation Demo Dashboard illustrates how these DQL queries can be used.
Be aware that the costs shown in the Demo Dashboard are based on manual cost assignments in the DQL query and are not automatically cross-checked with your rate card.