WunderGraph's Cosmo Router now supports GraphQL Cost Control, a feature that estimates and enforces operation costs before any subgraph is executed. It implements IBM's GraphQL Cost Directive specification, using @cost and @listSize directives for customization. Two modes are available: Measuring Mode (records cost without rejecting) and Enforcing Mode (rejects operations exceeding a cost limit). Estimated cost is computed statically at planning time, while actual cost is recorded dynamically from real subgraph responses. Use cases include throttling expensive clients, observing latency spikes, usage-based billing, and preventing deeply nested list abuse.

5m read timeFrom wundergraph.com
Post cover image
Table of contents
WhyHow It WorksAn ExampleFrequently Asked Questions (FAQ)

Sort: