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

[Metricbeat] Initialize processors in manifest.yml with TestData function #21817

Closed
kaiyan-sheng opened this issue Oct 14, 2020 · 5 comments · Fixed by #22854
Closed

[Metricbeat] Initialize processors in manifest.yml with TestData function #21817

kaiyan-sheng opened this issue Oct 14, 2020 · 5 comments · Fixed by #22854
Assignees
Labels
Team:Platforms Label for the Integrations - Platforms team

Comments

@kaiyan-sheng
Copy link
Contributor

Describe the enhancement:
For light weight modules, sometimes we have processors defined in manifest.yml file. But the processors are not initialized when running TestData function in integration test file to generate data.json.

For example: with the rename processor


we should see different names for the fields in the data.json file generate by TestData function in s3_daily_storage_integration_test.go:

Link: #21703 (comment)

cc @jsoriano

@kaiyan-sheng kaiyan-sheng added the Team:Platforms Label for the Integrations - Platforms team label Oct 14, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@kaiyan-sheng
Copy link
Contributor Author

After this is done, I will rerun TestData to generate new data.json files for s3_daily_storage and s3_request metricsets.

@jsoriano
Copy link
Member

jsoriano commented Oct 20, 2020

I have been investigating this issue and I think that the solution is not very straigth-forward.

The thing is that TestData, and mbtest helpers in general, call directly the native Fetch function, what has very little boilerplate.
Processors in light modules are initialized as part of the publisher, that is not instantiated at all in these integration tests.

So to be able to use the mbtest helpers with processors we would need to do one of these things:

  • Make the helpers aware of light modules so they can instantiate and execute the processors.
  • Refactor light modules to execute the processors as part of the fetch.

First option would be a bit tricky because it wouldn't be testing the real pipelines, but it would serve to generate the data.json files. Second one would be quite an intrusive change, and I think we already discarded this option while implementing processors in light modules.

For testing, there is an alternative, pipelines are executed in system tests, maybe we can use them to generate the data.json too.

I have pushed my tests here: master...jsoriano:lightmodules-processors-test
They include a system test where processors work.
Go tests fail, confirming that processors are not working with mbtest.

As there is a possible workaround with system tests, I am not sure if it worths the effort. In any case I will give a quick try to make the helpers aware of light modules processors.

@kaiyan-sheng do you think that system tests may work in your case?

@kaiyan-sheng
Copy link
Contributor Author

@jsoriano Thank you for the investigation! Yes if system tests can generate data.json for light modules with processors, that's fine for me!

@jsoriano
Copy link
Member

jsoriano commented Dec 2, 2020

In any case I will give a quick try to make the helpers aware of light modules processors.

Finally I tried this, and it seems to work well, PR open: #22854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Platforms Label for the Integrations - Platforms team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants