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

Config parsing error causes EA-managed apm-server to fail silently #14560

Closed
carsonip opened this issue Nov 6, 2024 · 3 comments · Fixed by #14574
Closed

Config parsing error causes EA-managed apm-server to fail silently #14560

carsonip opened this issue Nov 6, 2024 · 3 comments · Fixed by #14574
Assignees
Labels

Comments

@carsonip
Copy link
Member

carsonip commented Nov 6, 2024

APM Server version (apm-server version): Confirmed on main

Description of the problem including expected versus actual behavior:

When a config with a wrong schema is passed to an EA-managed apm-server, config is passed to reloader, and error is apparently not surfaced, but beater/server will just silently not start.

Steps to reproduce:

  1. Instead of setting apm-server.rum.response_headers to a list, set it to a string
  2. Observe the behavior under EA-managed

Provide logs (if relevant):

@carsonip carsonip added the bug label Nov 6, 2024
@carsonip
Copy link
Member Author

carsonip commented Nov 6, 2024

I haven't had the time to confirm the actual code path because one cannot simply run debugger on EA managed apm-server, but I suspect that the culprit is that the config parsing error is ignored by libbeat if it isn't a multierror.MultiError in https://github.com/elastic/beats/blob/38dfc52434ed2478b643d9b30f1a21c0e4c39603/x-pack/libbeat/management/managerV2.go#L836

@inge4pres
Copy link
Contributor

When running in managed mode there's an elastic-agent-lib component that validates config for us, by parsing the YAML into a config.C struct.
AFAIR a C.Validate() method can be implemented in our own types to specify rules applied when parsing the config.
I am not 100% sure but there may be validate struct tags that can be added where the config type is defined

https://github.com/inge4pres/apm-server/blob/de7e8075d330c68d826a52613e13bcdf08d34620/internal/beater/config/config.go#L39

to include/exclude certain values.

@simitt
Copy link
Contributor

simitt commented Nov 11, 2024

@carsonip assigned you to this task as you already opened a draft PR. IMO this doesn't have highest urgency or impact, so leaving the timing for the fix up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants