# Multi-Upstream Routing, Health Scoring, and Paid-Heatmap Self-Build Replacement

Canonical URL: https://dataroute.dev/method/routing-and-failover/
Author: DataRoute Engineering | Published: 2026-11-22

> How DataRoute selects between first-party engines and external upstream pools on every call, scores live provider health, records explicit provenance, and promotes high-demand routes onto owned infrastructure.

## 1. First-Party Primary vs. Dual-Upstream Proxy

        Every endpoint registered in the DataRoute catalog declares an explicit execution topology:

        
          - **First-Party Flagship Topology:** Core routes dispatch over internal HTTP contracts to dedicated first-party engines—`Ark` for X real-time social data (owned account pool prioritized ahead of budget-capped fallback), `Vaneform` for compliance-cleared site intelligence, and `PageReceipt` for public web capture.

          - **Dual-Upstream Proxy Topology:** High-demand cross-platform endpoints (Reddit, YouTube, TikTok, Google organic SERP) maintain at least two independent upstream providers normalized behind one DataRoute schema adapter.

        

        

## 2. Rolling Health Scoring & Circuit Breakers

        Static round-robin balancing keeps sending traffic into a broken upstream until an operator intervenes. DataRoute's planned router evaluates each upstream candidate using a rolling telemetry window tracking four signals:

        
          - **Schema-valid HTTP 200 rate:** Percentage of recent responses passing both transport status and required field verification.

          - **Tail latency (p95):** Prevents slow-degrading upstreams from stalling interactive AI agent tool calls.

          - **Throttle pressure:** Recent HTTP `429` and anti-bot challenge ratios trigger automatic traffic shedding.

          - **Effective unit cost:** Among healthy candidates within latency bounds, the router prefers lower-cost execution slots.

        
        When a primary candidate fails with a retryable error (`429`, `5xx`, timeout, or schema rejection) and remaining request deadline budget allows, the router fails over automatically to the next ranked healthy provider inside the same caller request.

        

## 3. Explicit Provenance & Auditability

        Every response emitted by DataRoute carries a structured `provenance` object containing `engine`, `upstream_id`, `failover_attempts`, `latency_ms`, and `fetched_at`. Internal billing logs store the exact serving provider and realized upstream cost alongside every `request_id`.

        
          **Zero silent degradation:** If a compliance-cleared field or requested schema contract cannot be satisfied by available healthy upstreams, DataRoute fails cleanly with a normalized non-billable error code and exact provenance telemetry.

        

        

## 4. Paid-Heatmap Self-Build Replacement Loop

        Building custom reverse-engineered adapters for twenty platforms upfront creates massive maintenance overhead before customer demand is proven. DataRoute operationalizes a disciplined three-step loop:

        
          - **Probe via Multi-Upstream Proxy:** Launch long-tail demand quickly behind the unified contract using vetted dual upstreams.

          - **Measure the Paid Call Heatmap:** Aggregate real paid call volume, realized unit margin, and upstream error rates per endpoint.

          - **Promote to First-Party Execution:** Whenever an endpoint crosses sustained paid demand thresholds, replace external proxy spend with a dedicated first-party adapter (including selective Stage 2 adoption of vetted regional social adapters for WeChat Official Accounts, Xiaohongshu, Weibo, and Bilibili) while keeping the external API contract unchanged.

        
        

```
{
  "request_id": "dr_req_01JDR9X4K8M2N7Q5V1W6Y3Z8",
  "route": "GET /v1/social/reddit/posts",
  "selected_upstream": "reddit_upstream_a",
  "failover_chain": ["reddit_upstream_a"],
  "http_status": 200,
  "schema_valid": true,
  "billable": true,
  "latency_ms": 342
}
```

## Key Takeaways
- Flagship routes execute on first-party engines (Ark, Vaneform, PageReceipt); long-tail routes use dual-upstream failover.
- Rolling health scoring tracks schema-valid HTTP 200 rate, p95 latency, throttle pressure, and effective unit cost.
- Every response records explicit provenance (engine, upstream_id, failover_attempts, latency_ms, fetched_at) for reconciliation.
- Paid call heatmaps drive selective Stage 2 replacement of external proxies with first-party adapters.

## Questions & Answers
### How many upstreams back a V1 Multi-Upstream endpoint?
High-frequency proxied endpoints in V1 Multi-Upstream are designed with at least two independent upstream providers so a single vendor outage triggers automatic failover within the same caller request.

### Does failover change the response JSON structure for callers?
No. Every upstream adapter normalizes provider-specific payloads into one canonical DataRoute schema before response emission. Only the provenance metadata reflects which upstream fulfilled the request.

### Will promoting a proxied endpoint to a first-party engine break existing integrations?
No. Because the public /v1/* path, request parameters, and response schema stay fixed while routing switches internally, callers gain lower latency and higher stability with zero code changes.

### Why record upstream cost and engine identity on every request?
Explicit per-request provenance ensures accurate gross-margin analytics for the paid-heatmap self-build loop, deterministic customer billing reconciliation, and verifiable source compliance audits.
