fix: merge per-tenant overrides with defaults for unset fields#6592
fix: merge per-tenant overrides with defaults for unset fields#6592electron0zero wants to merge 8 commits intografana:mainfrom
Conversation
10fb6e7 to
098a9fe
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 098a9fedcc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe6f310425
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
670a862 to
ec68bd7
Compare
we conerted into pointers so we can differentate between golang's default zero value vs "not set". pointer allows us to see if a config key is unset or set to zero.
ec68bd7 to
6865ad0
Compare
682c9dd to
fb79118
Compare
What this PR does:
Fixes a bug where per-tenant and wildcard overrides that only set a few fields cause all other fields to resolve to Go zero values instead of falling back to static defaults.
Bug: When a tenant has an override entry that sets only a subset of fields (e.g., just
max_cardinality_per_label: 100), all other fields resolve to Go zero values instead of the static defaults. This is because the override struct is returned as-is without merging in the defaults for unset fields.Fix: Each override entry is now field-level merged with static defaults at config load time using reflection. Unset fields fall back to defaults instead of being zero values. Merged views are pre-computed at load/reload - zero cost per request.
Fields where zero is semantically meaningful (e.g., 0 = "no limit", false = "disabled") are migrated to pointer types so the merge can distinguish "not set" (nil) from "explicitly zero" (*0).
This is needed because the merge uses "is this field zero?" to decide whether a field was set in the override file.
For most fields this works fine - a zero value means "not set". But some fields use zero as a real value:
max_bytes_per_trace: 0means "no limit",span_multiplier_key: ""means "disable multiplier".Without pointers, the merge would treat these as "not set" and overwrite them with the default, making it impossible for operators to explicitly set these values.
Pointer types solve this because we can check
niland assign it to "not set, fall back to default", non-nil zero = "explicitly set to this value".Behavior before this PR:
Behavior after this PR:
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]