Cherry-pick #16455 to 7.x: [Metricbeat] Update Couchdb to v2 #17078
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.
Cherry-pick of PR #16455 to 7.x branch. Original message:
What does this PR do?
Updates module to use a Strategy patern and decide between v1 and v2 Couchdb parsing. To do so, it has to do a pre HTTP request to root path
/
to know which version is deployed on each fetch (done in fetch to allow hot upgrades in container environment).I have removed
testdata
tests because one of them was a bit unnecessary with our currenttestdata
implementation (a timeout test which was testingtestdata
framework more than the module itself). The othertestdata
doesn't work anymore because more than one request is necessary now to check version.Because we can only test in CI with a single version, I maintained current Dockerfile
Why is it important?
ATM, we were only parsing v1 metrics and v3 is going to be released soon. This PR introduces v2 parsing maintaining compatibility with our previous version.
Checklist
- [ ] I have made corresponding change to the default configuration filesHow to test this PR locally
./metricbeat modules enable couchdb
and leave config similar to this:service.version
and theservice.id
must be the same for all paths of v2.Related issues
Screenshots
I checked that dashboard still works.