data_pulse
Contributor

@Islam_hoti 

We recently solved this use case to attribute the serverless cost. Our approach was not to rely on a single tagging mechanism, but to build a layered attribution on top of Databricks billing system tables.

The actual DBUs/cost always come from system.billing.usage. We enrich those records with the best available team ownership signal.

 Attribution SignalExample
1custom_tagsteam=pricing, team=risk..
2Resource identityjob_id, dlt_pipeline_id, warehouse_id, endpoint_id, app_id
3Resource → team mappingKnown Job/Pipeline/Warehouse mapped to owning team
4identity_metadata.run_asInteractive notebook / Databricks Connect user or SPI
5Platform/sharedDQ Monitoring, Predictive Optimization, networking, etc.
6UnattributedNo proper ownership signal

Core billing Columns from the Source

SELECT
  workspace_id,
  usage_date,
  billing_origin_product,
  sku_name,
  usage_metadata.job_id,
  usage_metadata.dlt_pipeline_id,
  usage_metadata.warehouse_id,
  usage_metadata.cluster_id,
  usage_metadata.interactive_source,
  identity_metadata.run_as,
  custom_tags,
  usage_quantity
FROM system.billing.usage;

For team attribution we use something conceptually like:

COALESCE(
  custom_tags['sandbox_teamname'],
  custom_tags['hub_teamname'],
  custom_tags['team'],
  element_at(custom_tags, 'group'),
  resource_team_mapping.mapped_team,
  identity_team_mapping.mapped_team
) AS attributed_team

Serverless jobs/pipelines

For Jobs, pipelines and similar resources, usage_metadata is particularly useful:

job_id → owning team
dlt_pipeline_id → owning team
warehouse_id → owning team
endpoint_id → owning team


We maintain an effective-dated resource_team_mapping for historical cost attribution.

Eg:

resource_type | resource_id | mapped_team | billing_start | billing_end
Job | 123456 | pricing | 2026-05-01 | NULL
DLT Pipeline | abc123 | risk | 2026-04-15 | NULL

That also solves an important historical problem: if a resource was untagged previously but subsequently receives a valid team tag, we can retro-attribute its historical billing records to the same resource/team without modifying system.billing.usage.

Interactive/serverless usage:

For usage without a Job/Pipeline/etc we fall back to: identity_metadata.run_as and also usage_metadata.interactive_source.

For eg:

billing_origin_product = INTERACTIVE
interactive_source = DATABRICKS_CONNECT
run_as = user/service-principal

How we implemented tagging:

  • Ownership tags such as team were added directly to workflow definitions in code base, making ownership part of deployment.
  • For classic compute, cluster policies, pool tags, and cluster custom tags were used to carry team ownership.
  • For serverless Jobs and pipelines, budget policies were deployed through Terraform and referenced through budget_policy_id. Their tags then flow into subsequent billing records under system.billing.usage.custom_tags.
  • For SQL warehouse, the ownership tags were provisioned as part of terraform. Can configure manually too, to edit and assign tags.

Budget Policies

Budget/serverless policies help significantly going forward because their tags can propagate into billing usage. But we found they shouldn't be considered the entire attribution solution:

Policy/resource tags
        ↓
system.billing.usage.custom_tags
        ↓
Resource mapping
        ↓
Identity mapping
        ↓
Platform/shared
        ↓
Unattributed

Platform costs

We also deliberately don't force everything onto teams. Things such as:

DATA_QUALITY_MONITORING
PREDICTIVE_OPTIMIZATION
NETWORKING
FINE_GRAINED_ACCESS_CONTROL

could represent Databricks managed/platform activity rather than a team-owned. Those can be kept as Platform/Shared rather than inventing an attribution.

Summary: we didn't accept all serverless spend as a central cost. We attribute what can be reliably attributed using tags → resource IDs → identity, explicitly retain platform/shared costs, and expose whatever remains genuinely unattributed.

I am working on a detailed blog post to cover comprehensively, but the above content covers most parts of it.