Skip to content

benchmarking(boomer): disentangle dynConfig - #2160

Open
Max Smythe (maxsmythe) wants to merge 1 commit into
agent-substrate:mainfrom
maxsmythe:dynconfig-json
Open

Max Smythe (maxsmythe) wants to merge 1 commit into
agent-substrate:mainfrom
maxsmythe:dynconfig-json

Conversation

@maxsmythe

Copy link
Copy Markdown
Collaborator

dynconfig had become one struct of every knob every user class ever needed, with a payload mirror, a merge, a validator, and a log line that all need to grow by hand for each new field, and every class saw and was checked against every other class's knobs.

The payload is now an arbitrary JSON object, and a worker runs exactly one user class, known at launch. So each class declares the keys it reads as a struct with json tags, wraps it in a dynconfig.Typed codec with its defaults and its validation func, and registers the codec with its userclass.Entry. The worker builds the holder from that codec; the holder stores the typed value, folds each payload into it with one decode over the current value (so an absent or null key keeps what it had), refuses a payload the class cannot run on in favor of the last good config, and hands the class its knobs back through dynconfig.Get. Keys the class does not name are ignored. The wait window and the resume and lifecycle modes are shared pieces a class embeds; durations travel as seconds, the unit the locust flags use.

Now we can implement user classes more independently of each other.

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

…e config

dynconfig had become one struct of every knob every user class ever
needed, with a payload mirror, a merge, a validator, and a log line that
all had to grow by hand for each new field, and every class saw and was
checked against every other class's knobs.

The payload is now an arbitrary JSON object, and a worker runs exactly one
user class, known at launch. So each class declares the keys it reads as a
struct with json tags, wraps it in a dynconfig.Typed codec with its
defaults and its validation func, and registers the codec with its
userclass.Entry. The worker builds the holder from that codec; the holder
stores the typed value, folds each payload into it with one decode over
the current value (so an absent or null key keeps what it had), refuses a
payload the class cannot run on in favor of the last good config, and
hands the class its knobs back through dynconfig.Get. Keys the class does
not name are ignored. The wait window and the resume and lifecycle modes
are shared pieces a class embeds; durations travel as seconds, the unit
the locust flags use.

The GluttonUser defaults the worker used to seed from main.go (a 500ms
max wait, one ping per wake) live in that class's codec now, and the
durdir read modes move into the glutton package with the class that reads
them.
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.

1 participant