Skip to content
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

fix: move beats cfgfile.HandleFlags call after the flags are parsed #14512

Merged
merged 5 commits into from
Nov 4, 2024

Conversation

1pkg
Copy link
Member

@1pkg 1pkg commented Nov 1, 2024

Motivation/summary

This PR fixes the issue with flags parsing in APM Server beats cmd. By moving cfgfile.HandleFlags to after the point when the flags are parsed by the cobra cli.

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

Build a snapshot EA image for ESS and run it.

Related issues

elastic/elastic-agent#589

@1pkg 1pkg added the backport-8.x Automated backport to the 8.x branch with mergify label Nov 1, 2024
@1pkg 1pkg self-assigned this Nov 1, 2024
@1pkg 1pkg requested a review from a team as a code owner November 1, 2024 16:48
@leehinman
Copy link
Contributor

LGTM

@1pkg 1pkg force-pushed the fix_cfgfile_handle_flag_parse_entrypoint branch from 652b284 to f1dc8a4 Compare November 1, 2024 17:02
Copy link
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

did a quick test on my end. tested with and without apm-server.yml in the directory and everything worked fine.

Tested with -E management.enabled=true and apm server correctly waited for it's config on stdin.

Tested with ./apm-server -E management.enabled=false -E logging.leve=debug --E logging.to_stderr=true --memprofile -1s -c ./apm-server.yml.bk and it found correct config file, wrote the memprofile to the file called "-1s", and correct debug level to stderr.

@kruskall kruskall enabled auto-merge (squash) November 4, 2024 22:18
@kruskall kruskall merged commit e2c0fb5 into main Nov 4, 2024
11 checks passed
@kruskall kruskall deleted the fix_cfgfile_handle_flag_parse_entrypoint branch November 4, 2024 22:27
mergify bot pushed a commit that referenced this pull request Nov 4, 2024
…14512)

* fix: move beats cfgfile.HandleFlags call after the flags are parsed

* fix: beats call to ConvertFlagsForBackwardsCompatibility on init

* fix: beatcmd add remaining flag into backward compatibble flags list

(cherry picked from commit e2c0fb5)
mergify bot added a commit that referenced this pull request Nov 4, 2024
…14512) (#14537)

* fix: move beats cfgfile.HandleFlags call after the flags are parsed

* fix: beats call to ConvertFlagsForBackwardsCompatibility on init

* fix: beatcmd add remaining flag into backward compatibble flags list

(cherry picked from commit e2c0fb5)

Co-authored-by: Kostiantyn Masliuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants