-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependencies from non-beater code on beater/config #8929
Conversation
Duplicate the configuration in agentcfg, translating to it from the beater/config struct in beater setup code.
Use kibana.ClientConfig directly. That type has grown an APIKey field since we defined ours.
Consruct fleet-server base URLs in the beater package, and duplicate the source map Fleet Artifact reference structure in the sourcemap package.
Introduce stream.Config, which is passed into the various Processor constructors. This is populated by beater.
This pull request does not have a backport label. Could you fix it @axw? 🙏
NOTE: |
📚 Go benchmark reportDiff with the
report generated with https://pkg.go.dev/golang.org/x/perf/cmd/benchstat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I too prefer de-coupling configs, I think that in practice it'll make little or no difference to be copying around the configuration since most of the copying will happen just once.
@@ -38,18 +37,22 @@ func TestConfigAgentHandler_AuthorizationMiddleware(t *testing.T) { | |||
rec, err := requestToMuxerWithPattern(cfg, AgentConfigPath) | |||
require.NoError(t, err) | |||
require.Equal(t, http.StatusUnauthorized, rec.Code) | |||
approvaltest.ApproveJSON(t, approvalPathConfigAgent(t.Name()), rec.Body.Bytes()) | |||
assert.JSONEq(t, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the beater refactoring ❤️
Motivation/summary
Stop depending directly on
beater/config
from all the packages. Instead, limit use ofbeater/config
tobeater
itself, and translate configuration into just the bits needed by each downstream package. This will enable us to make changes to configuration independently of updating downstream users.This does lead to a bit of duplication, but as Rob says, "a little copying is better than a little dependency".
Checklist
- [ ] Update CHANGELOG.asciidoc- [ ] Update package changelog.yml (only if changes toapmpackage
have been made)- [ ] Documentation has been updatedHow to test these changes
N/A
Related issues
#8928