Skip to content

feat: make BLQ stale threshold and static friction runtime-configurable#7880

Merged
kylemumma merged 2 commits intomasterfrom
krm/blq-configurable-thresholds
Apr 16, 2026
Merged

feat: make BLQ stale threshold and static friction runtime-configurable#7880
kylemumma merged 2 commits intomasterfrom
krm/blq-configurable-thresholds

Conversation

@kylemumma
Copy link
Copy Markdown
Member

@kylemumma kylemumma commented Apr 16, 2026

This PR is just replacing hardcoded constants with options so I can change the value at runtime. This is necessary for testing in s4s, I dont want to create an actual backlog of 30 minutes, so I will reduce stale threshold to say 4 minutes and test that.

Summary

  • Replaces hardcoded BLQ_STALE_THRESHOLD (30m) and BLQ_STATIC_FRICTION (2m) with two sentry-options keys: consumer.blq_stale_threshold_seconds (default 1800) and consumer.blq_static_friction_seconds (default 120).
  • BLQRouter now reads both values per-submit() the same way consumer.blq_enabled is read, so they hot-reload without a consumer restart. Friction <= 0 disables friction; friction >= threshold is ignored at runtime.
  • Drops the two constants and the corresponding BLQRouter::new arguments from factory_v2.rs.

Test plan

  • cargo check clean
  • cargo clippy --lib -- -D warnings clean
  • cargo test --lib blq_router — 4/4 pass, tests now set thresholds via override_options
  • Runtime smoke: with blq_enabled=true and blq_stale_threshold_seconds=5, confirm a 10s-old message routes to BLQ; flip the threshold to 3600 and confirm the next fresh message passes through without restart

🤖 Generated with Claude Code

…-options

Replaces the hardcoded 30m stale threshold and 2m static friction in
BLQRouter with two sentry-options keys (consumer.blq_stale_threshold_seconds,
consumer.blq_static_friction_seconds) read per-submit, matching the
hot-reload behavior of consumer.blq_enabled so these knobs can be tuned
without a consumer restart.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kylemumma kylemumma requested a review from a team as a code owner April 16, 2026 18:39
Comment thread rust_snuba/src/strategies/blq_router.rs
Comment thread rust_snuba/src/strategies/blq_router.rs
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b376219. Configure here.

Comment thread rust_snuba/src/strategies/blq_router.rs
@kylemumma kylemumma merged commit 447d507 into master Apr 16, 2026
46 of 47 checks passed
@kylemumma kylemumma deleted the krm/blq-configurable-thresholds branch April 16, 2026 21:17
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.

2 participants