Skip to content

int32 overflow on RequestSeriesItem.totalRequests breaks Studio at scale #2923

Description

@benevolent-donut

Component(s)

studio

Component version

0.165.0

wgc version

N/A

controlplane version

0.218.1

router version

N/A

What happened?

Description

wg.cosmo.platform.v1.RequestSeriesItem.totalRequests and erroredRequests, plus OperationRequestCount.totalRequests, are typed int32 in proto/wg/cosmo/platform/v1/platform.proto. For high-throughput federated graphs, per-bucket aggregations exceed int32 max and Studio's federated-graph dashboard fails to load.

This is most likely to surface at the larger granules. getWeeklyRequestSeries aggregates with toStartOfDay (one bucket per day), and getRequestSeries uses 1-hour buckets for the 30-day Studio view. A graph sustaining ~600k RPS hits the int32 ceiling within a single hourly bucket; daily buckets cross it at ~25k RPS sustained.

The underlying ClickHouse columns are already UInt64 (migration line 10), so the int32 ceiling is a wire-format bottleneck only.

Reproduced on @wundergraph/cosmo-connect@0.140.0, controlplane 0.218.1, studio 0.165.0.

Steps to Reproduce

  1. Have a federated graph with traffic high enough that a single bucket in cosmo.operation_request_metrics_5_30 aggregates over int32 max for one (FederatedGraphID, OrganizationID).
  2. As a quick reproduction without real traffic, insert a row directly:
    INSERT INTO cosmo.operation_request_metrics_5_30
      (Timestamp, OperationName, OperationHash, TotalRequests, TotalErrors, FederatedGraphID, OrganizationID, OperationType, RouterConfigVersion, IsSubscription, ClientName, ClientVersion)
    VALUES
      (now(), 'TestOp', 'hash', 2335440880, 0, '<your-fed-graph-id>', '<your-org-id>', 'query', 'v1', false, 'test', '1.0');
  3. Open Studio and load /<orgSlug>/<namespace>/graph/<graphName> — the dashboard view that calls GetFederatedGraphs with includeMetrics: true.

Expected Result

The dashboard loads and renders the request-series chart with the correct value.

Actual Result

Studio fails to load with:

[unknown] cannot decode field wg.cosmo.platform.v1.RequestSeriesItem.totalRequests from JSON: 2335440880: invalid int 32: 2335440880

Proposed fix

Widen the fields to int64 and the generated typescript will type the fields as bigint.

  message RequestSeriesItem {
    string timestamp = 1;
    int64 totalRequests = 2;
    int64 erroredRequests = 3;
  }

  message OperationRequestCount {
    string operationHash = 1;
    string operationName = 2;
    int64 totalRequests = 3;
  }

Happy to send a PR.

Environment information

Environment

OS: (N/A
Package Manager: npm
Compiler(if manually compiled): N/A

Router configuration

N/A

Router execution config

N/A

Log output

N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmed bugThe issue was replicated/determined to be a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions