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

Cherry-pick #18797 to 7.7: Fix panic on metricbeat test modules #18853

Merged
merged 3 commits into from
Jun 4, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented May 29, 2020

Cherry-pick of PR #18797 to 7.7 branch. Original message:

What does this PR do?

Fix panic on `metricbeat test modules`

Since metricbeat light modules support processors (#15923), module
initialization requires a publisher in the beat so modules can attach
their processors. `metricbeat test modules` is not initializing as
normal metricbeat commands, and it is not initializing any output or
publisher pipeline, so metricbeat panics when trying to initialize
modules with the new method.

This change adds a dummy publisher for this case, and fixes also a
condition that was adding a `nil` module option, causing additional
panics. A test that reproduced the issue is also added.

Why is it important?

metricbeat test modules is not working with modules defined in the main configuration file.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 29, 2020
Since metricbeat light modules support processors (elastic#15923), module
initialization requires a publisher in the beat so modules can attach
their processors. `metricbeat test modules` is not initializing as
normal metricbeat commands, and it is not initializing any output or
publisher pipeline, so metricbeat panics when trying to initialize
modules with the new method.

This change adds a dummy publisher for this case, and fixes also a
condition that was adding a `nil` module option, causing additional
panics. A test that reproduced the issues is also added.

(cherry picked from commit 25b8bf1)
@andresrc andresrc added the Team:Integrations Label for the Integrations team label Jun 1, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 1, 2020
Co-authored-by: Steffen Siering <steffen.siering@elastic.co>
@jsoriano
Copy link
Member Author

jsoriano commented Jun 2, 2020

Nil pipeline was not available in 7.7 branch, backporting it from #16715.

@jsoriano jsoriano requested a review from ChrsMark June 2, 2020 11:22
@jsoriano
Copy link
Member Author

jsoriano commented Jun 3, 2020

jenkins run the tests please

@jsoriano jsoriano merged commit 3b93101 into elastic:7.7 Jun 4, 2020
@jsoriano jsoriano deleted the backport_18797_7.7 branch June 4, 2020 11:24
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…es` (elastic#18853)

Since metricbeat light modules support processors (elastic#15923), module
initialization requires a publisher in the beat so modules can attach
their processors. `metricbeat test modules` is not initializing as
normal metricbeat commands, and it is not initializing any output or
publisher pipeline, so metricbeat panics when trying to initialize
modules with the new method.

This change adds a dummy publisher for this case, and fixes also a
condition that was adding a `nil` module option, causing additional
panics. A test that reproduced the issues is also added.

(cherry picked from commit 316793d)

Add nil pipeline from elastic#16715, required for the fix.

(cherry picked from commit 257fdfc)

Co-authored-by: Steffen Siering <steffen.siering@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport review Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants