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.
How it runs
The automated pipeline, trigger to output.
- TriggerDaily schedule (run after billing close)
- ActionQuery Datadog per-customer usage metricsDatadog
- ActionRead total cloud + observability cost from SnowflakeSnowflake
- LogicAllocate spend by usage share with fixed-cost floor
- OutputWrite per-customer COGS partition to SnowflakeSnowflake
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
- 1A daily schedule fires the run.
- 2It queries Datadog for per-customer usage signals (compute hours, request counts, ingested bytes) tagged by customer ID.
- 3It reads the day's total cloud and observability cost from a Snowflake billing table.
- 4A logic step allocates total cost across customers proportional to each customer's usage share, with a fixed-cost floor per account.
- 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.
- 1Connect DatadogMetrics, traces, log search.
- 2Connect SnowflakeWarehouses, queries, shares.
- 3Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
- 4Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
- 5Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.
More Finance workflows
Expense Submission Webhook Instant Triage and Routing
Receives each expense submission via webhook the instant it's filed, classifies it as in-policy, needs-review, or hard-violation, and routes it to auto-approval.
Monthly Vendor Spend Anomaly Brief for Finance Leads
Once a month, an agent analyzes the full expense ledger for vendor and category spend anomalies, drafts a narrative brief with the top outliers and likely causes.
Accrual Chase Board in Monday with Per-Owner Tasks
On a schedule it reads open uncoded expenses from Snowflake and creates or updates a Monday item per department owner.
Detect Annual-to-Monthly Downgrade Refunds Owed
Catches subscriptions switched from an annual term to monthly partway through the prepaid year, computes the unused prepaid balance owed back.
Detect Mid-Cycle Plan Change Mischarges and Queue Credit Memos
Listens for Stripe subscription plan changes, recomputes the correct prorated amount.
Overdue Accrual Escalation Emails to Owners and Managers
On a schedule it flags uncoded spend that has stayed open past the chase deadline and emails each delinquent owner via Gmail.
Run it inside a business
This workflow drops into a full company template. Import the org, and this is one of the playbooks its agents run.

Run this workflow in your colony.
14-day trial. No DevOps. No Sales call. Provisioned in under a minute.
