Skip to main content

Design a custom routing graph

Who: the router’s owner · custom routers only Where: Router → open the router
  1. Open the router. Drag actions from the Actions palette onto the canvas, or click them.
  2. Build the graph from left to right: signals read the request, a decision combines signals into a route, an algorithm chooses among the route’s deployments, and plugins change the request or the answer. Wire a step to the one it depends on. A signal or projection connects to the start; an algorithm or plugin must connect to a decision.
  3. Click a node to name it and set its Parameters. Use Auto Layout, Vertical Layout, Horizontal Layout and Fit View to tidy the canvas.
  4. Click Save. This validates the graph, makes the router active and returns you to the list (“Router saved”). Errors name the step that failed.
Always include a default route. A request that matches no route is refused with HTTP 503, type router_resolution_failed, code no_decision_matched (“No rule in router ’…’ matched this request. Add a fallback rule in the router editor, or broaden one of the existing rules”). Give the last decision a low priority and a rule that matches everything.

The building blocks

Signals: what to look at in the request

Decisions and projections: how signals become a route

Algorithms: how a route picks a deployment

Plugins: change the request or the answer

Two recipes

Canary: 90/10

  1. Create a Decision whose rule matches the requests you want to split.
  2. Set its Endpoints to the stable and the new deployment.
  3. Attach Weighted Random, with weights 90 and 10.
  4. Save and publish. To widen the rollout or roll back, change the weights and save again.

Cascade: cheap first

  1. Create a Decision whose rule matches the requests to cascade.
  2. Set its Endpoints: the cheap model first, the strong one last.
  3. Attach Confidence Looper with Small to Large and a threshold such as 0.7.
  4. Raise the threshold for more quality, lower it for more savings.