Skip to content

fix(pm-ws-latency): extend histogram buckets, clarify Kalshi delta-only WS - #1684

Merged
Flotapponnier merged 1 commit into
devfrom
fix/pm-ws-latency-kalshi-buckets
Jul 29, 2026
Merged

fix(pm-ws-latency): extend histogram buckets, clarify Kalshi delta-only WS#1684
Flotapponnier merged 1 commit into
devfrom
fix/pm-ws-latency-kalshi-buckets

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Summary

  • wsConnectToSnapshot max bucket was 10s — 100% of Kalshi observations were overflowing to +Inf, causing histogram_quantile to 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.
  • wsInterarrival max bucket was 120s — p90 was overflowing. Added 180/300/600s buckets to capture long quiet-market gaps.
  • YAML findings, methodology, provider formula, and per_chain_explainer updated to accurately describe the Kalshi delta-only model vs Polymarket's immediate snapshot model.

What the stuck 10.00s was

All Kalshi wsConnectToSnapshot observations land in +Inf (confirmed via Prom bucket query — every finite bucket shows 0). histogram_quantile returns 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

  • Check staging: Kalshi connect-to-snapshot no longer shows stuck 10.00s after Railway redeploy
  • Check YAML methodology section renders correctly on bench page
  • Verify Polymarket metrics unaffected (all observations still in sub-10s buckets)

…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.
@Flotapponnier
Flotapponnier merged commit b34a757 into dev Jul 29, 2026
1 check failed
@Flotapponnier
Flotapponnier deleted the fix/pm-ws-latency-kalshi-buckets branch July 29, 2026 15:04
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