count shared <initlabels> against every section's limit - #267
Merged
Conversation
Contributor
Author
|
This is follow-up of #266 |
kenhys
force-pushed
the
fix-initlabels-followup
branch
2 times, most recently
from
August 31, 2026 05:45
63423e1 to
8714ccd
Compare
Before: the check ran in the constructor. Only a section with <initlabels> ran it. A section without `initialized true` was never checked. A section with `max_series_per_metric 0` did not add its <initlabels> to the shared count. In both cases the limit was already full at startup. The section then dropped every record with a new label set. The order of the sections changed the result as well. After: <initlabels> take their slots even when the section has no limit. The check runs for every section after all of them are built. A section is refused at startup when the shared label sets do not fit its limit. The order of the sections does not matter. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
kenhys
force-pushed
the
fix-initlabels-followup
branch
from
August 31, 2026 05:47
8714ccd to
0061160
Compare
kenhys
marked this pull request as ready for review
August 31, 2026 05:49
Watson1978
requested changes
Aug 31, 2026
| def check_series_limit! | ||
| return if @max_series_per_metric <= 0 | ||
| # two <initlabels> blocks with the same values make one label set | ||
| held = @series_set.size |
Contributor
There was a problem hiding this comment.
Reloading via /api/config.gracefulReload now fails.
The RPC returns {"ok":true} but the worker logs "metric X already holds 4 label sets from <initlabels> ... but max_series_per_metric is 3" and keeps the old config.
Before: the check counted every label set the metric held, and the set stays on the client metric over a reload. A reload then failed with "already holds N label sets from <initlabels>" even when the configuration did not change. A section with no <initlabels> was refused too, when another section with the same name had a wider limit. After: the check counts only the label sets from <initlabels>. A reload with the same configuration passes. Those read before the reload are still counted, because the client still holds them. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
Watson1978
approved these changes
Sep 1, 2026
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.
Before: the check ran in the constructor. Only a section with
ran it. A section without
initialized truewas neverchecked. A section with
max_series_per_metric 0did not add itsto the shared count. In both cases the limit was already
full at startup. The section then dropped every record with a new label
set. The order of the sections changed the result as well.
After: take their slots even when the section has no limit.
The check runs for every section after all of them are built. A section
is refused at startup when the shared label sets do not fit its limit.
The order of the sections does not matter.