Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] Testing: Allow use of different directory to test data instead of the expected one #34467
[Metricbeat] Testing: Allow use of different directory to test data instead of the expected one #34467
Changes from 20 commits
c0d45a0
eaa103d
150df6b
2693f39
7eeeb91
9d7e4c9
b1ef5ad
5b7a2cd
b54289e
8682c37
129baac
e5890e2
e9fbddd
b340c6c
9d755ea
b6b1a2d
e0c13cc
c36ebd9
5f512ed
a8aebff
e5be71c
79f4804
22abe62
5a8fa8c
febd2e2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reason of generation
data.json
now? for bothsamelabeltestdata
andtestdata
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, that was already in the code. It was added because I ran the tests locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean? those files were not in
samelabeltestdata
andtestdata
folders before your changes. And as I see in other modules this file is not present (example - https://github.com/elastic/beats/tree/main/metricbeat/module/prometheus/collector/_meta/testdata, similar files structure with theopenmetrics
module)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, should have been more clear. There are these lines to create that file. Since I ran the tests locally, the files were created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if running tests locally from main branch (as described in this doc)
data.json
are not created on the metricsets level, please double check why it gets created after your changesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be a breaking change for our documentation, it should be changed
@elastic/elastic-agent-data-plane could you please review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am interpreting this correctly, we are proposing to stop updating the data.json file that is used to render example events published in our official documentation? For example https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-redis-info.html that was already linked?
If this understanding is correct then,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're correct. But the way we are referencing these files is wrong. And the one that you linked is not affected by this, because there are no files referenced there generated by this function. But going back to the ones that are actually affected... We can see a good example in this changed module
openmetrics
. We have two newdata.json
files: one forsamelabeltestdata
(created by running this test) and another fortestdata
(created by running this test). Previously, running these two tests would result in just onedata.json
file (running one function after the other, is overwriting what the other did), misplaced in this directory.So if:
data.json
file and never have the possibility to create more than one for different configs, this PR is breaking that.data.json
files in some of the modules. If this is not done, the referenceddata.json
files in the docs will stop being updated.I would say that as it is now, this is a bug and we should fix it.
But if we want to keep doing 1., then updating it would be very easy as all the docs files are auto generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went and looked at how the data.json files are actually pulled into our documentation. Picking the Redis info one that is already referenced (arbitrarily, I know it isn't affected) the data.json file is included in the docs with this asciidoc syntax:
beats/metricbeat/docs/modules/redis/info.asciidoc
Lines 16 to 27 in 0d90255
You can see that we are explicitly linking to the data.json file to generate an example event.
I think the only two requirements here are:
We can change the name of the .json file and the number of .json files generated as long as we update the links in the documentation to account for that.
I don't think only having one data.json file is a requirement. We can link to multiple different files as needed.
We can change the path to the generated files as needed, we just need to also update the relative paths referenced in the .asciidoc files that are used to generate the documentation as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I noticed. To avoid changing the path then (I think this would be very simple, we would just need to change this part of the template), I set a default one specifically for the
data.json
file. By default this path is always the same, so if there are two tests overwritting this file (like it is happening with the module openmetrics), at least there is a chance now to change the path for one of the files if it is needed.So this way we keep updating the old
data.json
files and give an option if we want to create more than one.