-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
refactor beats argument parsing #41277
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform) |
Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform) |
Pinging @elastic/sec-deployment-and-devices (Team:Security-Deployment and Devices) |
|
||
"github.com/elastic/beats/v7/libbeat/common" | ||
"github.com/elastic/beats/v7/libbeat/common/fleetmode" | ||
"github.com/elastic/elastic-agent-libs/config" | ||
"github.com/elastic/elastic-agent-libs/logp" | ||
) | ||
|
||
// Command line flags. | ||
// Evil package level globals |
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.
I love the honesty on this comment ❤️
968dbf6
to
ffcfe48
Compare
f0f6e8a
to
60b1b1c
Compare
64f67f9
to
c2f8a09
Compare
20e1daf
to
1242459
Compare
Proposed commit message
Change beats argument parsing behavior.
Beats currently sets some command line flags in an init function, this means that any other project that imports beats will have conflicts if it uses the same options. This change moves this out of init.
Beats currently modifies the Argument list to offer backwards compatibility for flags in an init function. This would convert flags like
-e
to--e
. This means if any other project imports beats, it's argument parsing would be changed. This change adds an allowed list of arguments that can be changed and moves it out of init.Beats currently detects if it is
fleet managed
by looking at the command line flags. This change keeps that behavior, but adds the ability to set this directly. This allows setting the flag without the command line option.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
The goal is none, however if any flags are missed, then the user would have to call them as
--flag
instead of-flag
.Author's Checklist
elastic-agent
elastic-agent
apm-server
How to test this PR locally
Related issues
Use cases
Screenshots
Logs