fix(pm-ws-latency): extend histogram buckets, clarify Kalshi delta-only WS - #1684
Merged
Conversation
…nly WS wsConnectToSnapshot max was 10s — all Kalshi observations overflowed to +Inf causing histogram_quantile to return a stuck 10.00s. Kalshi's ticker channel sends no snapshot on subscribe (delta-only), so first-frame latency reflects time to next price change (typically 10-300s). Buckets now go to 300s. wsInterarrival max was 120s — p90 was overflowing. Add 180/300/600s buckets. YAML findings, methodology, formula, and per_chain_explainer updated to describe the methodological difference from Polymarket.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wsConnectToSnapshotmax bucket was 10s — 100% of Kalshi observations were overflowing to+Inf, causinghistogram_quantileto return a stuck 10.00s. Root cause: Kalshi ticker channel is delta-only (no state snapshot on subscribe), so first-frame latency = time to next price change (10–300s). New max: 300s.wsInterarrivalmax bucket was 120s — p90 was overflowing. Added 180/300/600s buckets to capture long quiet-market gaps.findings,methodology, providerformula, andper_chain_explainerupdated to accurately describe the Kalshi delta-only model vs Polymarket's immediate snapshot model.What the stuck 10.00s was
All Kalshi
wsConnectToSnapshotobservations land in+Inf(confirmed via Prom bucket query — every finite bucket shows 0).histogram_quantilereturns the max finite bucket when all observations are in+Inf→ 10.00s regardless of scope.Scope buttons showing same value
Expected behavior: scope buttons change the chart x-axis window; headline values always use the 24h
prometheus.window. Not a bug.Required after merge
Railway pm-rate-limits (us/eu/sgp) needs a redeploy to pick up the new histogram bucket config. Until then, bucket distribution won't change. After redeploy, Kalshi's actual first-frame latency distribution (10–300s range) will become visible.
Test plan