Skip to content

feat(slos): latency ladder counters on the service overview rollups - #2294

Merged
Makisuo merged 6 commits into
feat/slo-modelfrom
feat/slo-latency-ladder
Nov 6, 2026
Merged

Makisuo merged 6 commits into
feat/slo-modelfrom
feat/slo-latency-ladder

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Stack: #2293 model, #2294 latency ladder, #2295 compute, #2296 burn alerts, #2297 MCP, #2298 UI

Part 2 of 6. This PR lets latency SLOs read 30-day windows from the rollups instead of raw spans.

Why it's needed. The service rollups store only quantile summaries, plus an Apdex counter at a fixed 500 ms. That means "share of spans faster than X" could only be computed exactly at 500 ms.

What changed

  • New columns. Migration 0059 adds nine sampling-weighted counters to service_overview_hourly and service_overview_minutely:
    • EstimatedUnder{50,100,250,500,1000,2500,5000,10000}Ms, each sumIf(SampleRate, Duration < ms) over any status;
    • a coverage total, EstimatedLadderSpanCount.
  • Old buckets. Buckets written before the migration read 0 coverage, so they drop out of a latency SLI instead of reading as all slow. There is no backfill.
  • Deploy method. Both views use DEPLOYMENT_METHOD alter, the same fix migration 0023 needed. Without it, a rebuild would replay 30-day traces into the 90-day and 365-day rollups. retention-matrix.test.ts now covers both views.
  • Local store. Local schema goes to v51, with a migration edge that adds the columns and recreates the views.

Verification

  • A ClickHouse e2e test compares both rollups' rungs and coverage with a raw scan.
  • A pre-migration row reads 0 coverage.
  • A chDB local-store test checks the v50 to v51 edge.
  • clickhouse:schema:check and tinybird:manifest:check pass.
  • Not yet verified: the Tinybird deploy itself. It gets checked on the preview's Tinybird branch.

🤖 Generated with Claude Code

service_overview_hourly and service_overview_minutely gain EstimatedUnder<ms>Ms
for each SLO_LATENCY_THRESHOLDS_MS rung (50ms to 10s): sumIf(SampleRate,
Duration < ms), entry-point spans of any status. The view SELECTs are generated
from the ladder constant, and sloLatencyColumnName maps a threshold to its column.
Both views now deploy with DEPLOYMENT_METHOD alter so the column addition does
not rebuild the year-long hourly table from 30 days of traces.

Migration 0058 adds the columns (DEFAULT 0) and recreates both views; local
schema v50 does the same and verifies the rollup row counts are unchanged.
Existing buckets read the ladder as 0 and are not backfilled.
EstimatedLadderSpanCount (sum(SampleRate), DEFAULT 0) sits before the eight
rungs on both service overview rollups. A bucket materialized before 0058 reads
0 for it, so a latency SLI over total = sum(EstimatedLadderSpanCount) and
good = sum(EstimatedUnder<ms>Ms) counts only covered spans instead of scoring
old buckets as all slow. SLO_LATENCY_COVERAGE_COLUMN names it.

Folded into migration 0058 and local schema v50, neither of which has shipped.
The retention-matrix gate now requires DEPLOYMENT_METHOD alter on both views.
main landed migration 0058 and local schema v50 first: the ladder is now
migration 0059 and local schema v51, artifacts regenerated.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 61bbac98-b131-485f-a881-933eb589b5d4
Commits

Reviewing files that changed from the base of the PR and between 9232463 and 79897a7.

Files ignored due to path filters: 2

  • packages/domain/src/generated/clickhouse-schema.ts is excluded by !**/generated/**
  • packages/domain/src/generated/tinybird-project-manifest.ts is excluded by !**/generated/**
Files selected for processing: 18

  • apps/cli/src/server/local-store-migrations/steps.ts
  • apps/cli/src/server/schema-snapshots.ts
  • apps/cli/src/server/schema/local-schema-v51.sql
  • apps/cli/test/local-store-migrations.test.ts
  • apps/cli/test/local-store-slo-latency-ladder.test.ts
  • apps/cli/test/native-local-store-migration.sh
  • apps/ingest/src/clickhouse_insert_mappings.rs
  • packages/backend/src/services/warehouse/service-overview-parity.clickhouse.e2e.test.ts
  • packages/domain/src/clickhouse/migrations/0059_service_overview_slo_latency_ladder.ts
  • packages/domain/src/clickhouse/migrations/index.ts
  • packages/domain/src/tinybird/datasources.ts
  • packages/domain/src/tinybird/materializations.ts
  • packages/domain/src/tinybird/retention-matrix.test.ts
  • packages/local-server/src/local-schema-history.ts
  • packages/local-server/src/local-schema-version.ts
  • packages/local-server/src/schema-identity.ts
  • packages/local-server/src/schema/local-inserts.json
  • packages/local-server/src/schema/local-schema.sql
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@maple-review-bot

This comment has been minimized.

@maple-review-bot

maple-review-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 10/10 · safe to merge. Column order, frozen DDL and generated schema all agree, and the ladder, its zero coverage on old buckets and the v50 to v51 edge are each pinned by a test.
no findings · tests covered · risk high

Adds nine sampling-weighted SLO latency ladder counters to both service overview rollups, in migration 0059, the Tinybird views (deployed by ALTER) and the v51 local schema, with tests for the view math, the zero coverage of pre-0059 buckets and the chDB edge. Safe to merge.

  • Migration 0059 adds the eight rungs plus EstimatedLadderSpanCount and recreates both overview views
  • SLO_LATENCY_LADDER_SQL derives the rung SQL from SLO_LATENCY_THRESHOLDS_MS; both views deploy by alter
  • Local store goes to v51 with addColumns and view drops in the step, plus a v51 snapshot

Before merge

79897a7 · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@Makisuo

Makisuo commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Tinybird deploy verified on the #2298 preview branch, which carries this migration: deploy run, commit 55eb73d. tb --cloud deploy reported:

  • service_overview_hourly and service_overview_minutely: status: modified (the nine new columns).
  • service_overview_hourly_mv and service_overview_minutely_mv: "This materialized view will be updated using ALTER TABLE ... MODIFY QUERY". There was no backfill or rebuild warning for either, so the 365-day hourly history is kept.
  • ✓ Deployment #2 is live!, and the preview's seed and smoke test passed.

@Makisuo
Makisuo merged commit b1c612d into main Nov 6, 2026
42 checks passed
@maple-review-bot

Copy link
Copy Markdown

Merged with 3 steps from "Before merge" still open. If they are done, tick them on the review comment; if not, now is the time.

  • Manual · Watch the first Tinybird branch deploy: both overview views must apply by ALTER with no rebuild; the author flags this unverified
  • Migration · Check it is safe on production data and with the code still deployed
  • Warehouse · Deploy the schema before the code that reads it

@Makisuo
Makisuo deleted the feat/slo-latency-ladder branch November 6, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant