FINANCE

Per-Customer COGS Allocator from Datadog + Cloud Cost

Pulls Datadog usage metrics and cloud cost data, allocates infrastructure spend to each customer by usage share, and writes a per-customer COGS table to Snowflake.

CategoryFinance
Enginesim
Difficultyintermediate
Triggerschedule
Steps5
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerDaily schedule (run after billing close)
  • ActionQuery Datadog per-customer usage metricsDatadogDatadog
  • ActionRead total cloud + observability cost from SnowflakeSnowflakeSnowflake
  • LogicAllocate spend by usage share with fixed-cost floor
  • OutputWrite per-customer COGS partition to SnowflakeSnowflakeSnowflake

What it does

Every night it computes how much infrastructure each customer actually consumed and turns raw cloud spend into a clean per-customer cost-of-goods-sold (COGS) figure. The output lands in Snowflake as a dated fact table your BI tools and other workflows can query.

When to use it

Use it when your cloud bill is one big number and you can't say which customers are cheap to serve and which are expensive. It's the foundation for margin analysis, pricing reviews, and the margin-alert workflows in this catalog.

How it works

  1. 1A daily schedule fires the run.
  2. 2It queries Datadog for per-customer usage signals (compute hours, request counts, ingested bytes) tagged by customer ID.
  3. 3It reads the day's total cloud and observability cost from a Snowflake billing table.
  4. 4A logic step allocates total cost across customers proportional to each customer's usage share, with a fixed-cost floor per account.
  5. 5It writes the resulting `customer_id, cost_date, allocated_cogs, usage_share` rows back to a Snowflake COGS table, replacing any same-day partition.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect DatadogMetrics, traces, log search.
  2. 2
    Connect SnowflakeWarehouses, queries, shares.
  3. 3
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  4. 4
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  5. 5
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.