feature(agent): make catalog EWMA alpha configurable - #246
Open
nghiadaulau wants to merge 1 commit into
Open
Conversation
The EWMA smoothing factor for each pattern's baseline frequency was hardcoded to 0.2 in the worker. Promote it to agent.catalog.ewma_alpha (default 0.2, range (0,1]) so operators can tune how fast baselines react to recent ticks. The baseline is what spike detection compares against, so this knob tunes spike sensitivity. - AgentCatalogConfig.EwmaAlpha + clone_config mirror (config triple-touch), with a cloneConfig round-trip test. - worker reads it with a 0.2 fallback when unset; catalog.go keeps its defensive alpha<=0 floor. - config.yaml default + docs. - CONTRIBUTING: document the config triple-touch rule (struct + clone_config + config.yaml) so future fields don't silently drop per-request overrides. Not exposed in the Helm chart: the chart intentionally surfaces no agent.catalog tuning (spike_multiplier, persist_interval, etc. are all code-default only), so ewma_alpha follows the same convention.
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.
Summary
Promotes the pattern-baseline EWMA smoothing factor from a hardcoded
0.2to a configurable
agent.catalog.ewma_alpha(default0.2, range(0,1]). Each pattern's baseline frequency isbaseline = ewma_alpha·tick + (1−ewma_alpha)·baseline; higher reactsfaster to recent ticks, lower is steadier. Since spike detection compares
the live frequency against this baseline (
spike_multiplier), the knobdirectly tunes spike sensitivity — previously un-tunable.
Changes
AgentCatalogConfig.EwmaAlpha(ewma_alpha), threaded into the workerwith a
0.2fallback when unset;catalog.gokeeps its defensivealpha <= 0floor.clone_configdeep-clone +config/config.yamldefault, with acloneConfiground-trip test (anun-mirrored field silently resets to
0→ the fallback on everyquery-param-overridden request).
src/agent/configuration.mdcatalog table +CHANGELOG.future config fields don't repeat the omission.
Not in Helm — deliberately
The chart exposes no
agent.catalogtuning today (spike_multiplier,persist_interval,auto_promote_afterare all code-default only), soewma_alphafollows the same convention rather than being the lone catalogknob in
values.yaml. Happy to add the whole catalog block to the chart ina follow-up if you'd prefer.
Testing
TestNewWorker_EwmaAlphaFromConfig— worker reads the configured valueand defaults to
0.2when unset.TestCloneConfigCarriesEwmaAlpha— survives acloneConfiground-trip.gofmt,go vet,go build ./...,go test -race ./pkg/config ./pkg/agentgreen.
Checklist
0.2default)feature:prefix); docs + CHANGELOG + CONTRIBUTING