Dynatrace provides two cost allocation attributes—dt.cost.costcenter and dt.cost.product—as part of the primary Grail field set. These attributes enable precise attribution of Dynatrace consumption (DPS) to organizational units, applications, or cost centers.
The general principle mirrors security context configuration: enrich telemetry with cost allocation attributes as early as possible, ideally at the source, and align with your existing organizational structure and deployment scopes.
The approach for OneAgent-based deployments depends on the required granularity.
If cost attribution at the host group level is sufficient, the preferred approach is to map deployment-level primary Grail fields such as dt.host_group.id or host.name to dt.cost.costcenter and dt.cost.product via the Cost Allocation stage in OpenPipeline.
You can also set dt.cost.costcenter and dt.cost.product directly as host tags during OneAgent installation or via the central primary Grail tag configuration. This ensures the cost allocation attributes are present on all telemetry from that host.
For shared infrastructure where different processes should be attributed to different cost centers, use the DT_TAGS environment variable to set dt.cost.costcenter and dt.cost.product on each process.
For details, see Set up cost allocation for OneAgent deployments.
For Kubernetes, the approach depends on whether cluster or namespace-level granularity is sufficient or whether finer-grained attribution is needed.
Map k8s.cluster.name or k8s.namespace.name to dt.cost.costcenter and dt.cost.product via OpenPipeline.
Where you already have cost center and product information in Kubernetes namespace labels or annotations, use Kubernetes metadata enrichment to map those labels directly to dt.cost.costcenter and dt.cost.product. This materializes the cost allocation attributes across all Kubernetes-generated telemetry.
Dynatrace supports finer-grained approaches such as DynaKube custom resources or dedicated pod annotations.
Pod annotations don't enrich Kubernetes metrics, events, Smartscape entities, or Prometheus metrics. They only apply to logs and spans from the annotated pods.
For cost allocation based on combinations of labels and metadata, enrich telemetry with the relevant labels first, then use OpenPipeline processing to derive dt.cost.costcenter and dt.cost.product.
For details, see Set up cost allocation for Kubernetes deployments.