Skip to content

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

Merged
jsoriano merged 3 commits intoelastic:7.7from
jsoriano:backport_18797_7.7
Jun 4, 2020
Merged

Cherry-pick #18797 to 7.7: Fix panic on metricbeat test modules#18853
jsoriano merged 3 commits intoelastic:7.7from
jsoriano:backport_18797_7.7

Conversation

@jsoriano
Copy link
Copy Markdown
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)
@jsoriano jsoriano force-pushed the backport_18797_7.7 branch from ca0f2ae to 37ace56 Compare May 29, 2020 14:42
@andresrc andresrc added the Team:Integrations Label for the Integrations team label Jun 1, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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