Agent Wranglers

INF-72Recommended

Track cost per request

Divide each service's monthly cost by the work it did, such as cost per 1,000 requests or per active customer. Send each owning team its own figures every month, and alert when a unit cost rises more than 20% from the month before.

How to do it

Total cost grows with traffic, which is expected. A rising cost per unit means scaling went wrong, such as an autoscaler that never scales down or a cache that misses. Watch what the service costs tracks the totals and tags. Take the request counts from rate, errors and duration. Show the unit cost on the service dashboard, and compare it before and after each scaling change. Group the bill by the owner and service tags from Tag every resource with its owner. Split shared costs, such as a cluster, by a written key such as CPU hours. A monthly report to each team, without charging them, is called showback. It makes each team see what its own choices cost.

How to check

A monthly report shows the cost per 1,000 requests for each service and goes to the team in its owner tag. Shared costs in the report add up to the shared bill within 5%. An alert fires when a unit cost rises more than 20% from the month before.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/cost-per-request">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.