Repository navigation
Keep the tenant a string when sampling concurrency - #13595
Merged
Merged
Conversation
A tenant is a project sequence, so grouping deltas into $deltas[$tenant] turned every key into an int, and the store rejects a tenant that is not a non-empty string. Production has logged nothing but concurrency sample failed, continuing: Metric #0: 'tenant' is required (non-empty string) when shared tables are enabled on every run since the deploy, so the gauge is frozen on the samples the old carried fold left behind and billing still reads their peak. The carried fold took the tenant off the row and never had a key to cast. Two reasons the tests missed it: the double accepted any tenant where the adapter refuses a non-string, and the fixtures used 't1', which PHP keeps as a string key. Both now match production, and the suite fails with the same message the pods logged.
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
2 of 4 tasks
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.
Follow-up to #13520, which is live and currently sampling nothing.
What is happening in production
Every
stats-resourcesrun since the deploy has logged:So
Concurrency::sample()throws beforeaddBatch, no gauge sample is written, and the newestrealtime.connectionssample is the last one the old carried fold left behind. Billing takesmax()over the cycle, so it still reads the inflated carried peak — in fra1 the gauge sits at 28,988 against 1,930 connections actually open, and 699 is what the windowed fold would write for the current bucket.Cause
A tenant is a project sequence — a numeric string like
356187. Grouping deltas per tenant:Adapter\ClickHouse::addBatch()requires a non-empty string and throws. The carried fold read the tenant off the row inside the loop and never had an array key to be cast, which is why this only appeared with the paging refactor.Fixed by casting once at the top of the loop.
Why the tests missed it, and what changed
Two failures of fidelity, both now closed:
addBatchrecorded whatever it was handed. It now rejects a non-string or empty tenant with the adapter's own message, so any test would catch this.'t1','t2'— non-numeric, so PHP keeps them as string keys and the cast never happens. They are now real project sequences (356187,478539,605738).Verified: with the cast, 7 tests / 7 assertions green. Without it, the suite fails with the identical message the pods logged.
Deploying this
Cloud needs a
composer.lockbump to pick it up. Until then the realtime concurrency gauge does not advance at all, and the billing peak stays on pre-fix values.