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

libbeat/template: duplicate entries in fields.yml leads to repeated dynamic templates #23240

Merged
merged 3 commits into from
Feb 6, 2021

Conversation

axw
Copy link
Member

@axw axw commented Dec 22, 2020

What does this PR do?

In case of duplicate fields, do not generate duplicate dynamic_template items. We already deduplicate field mappings because there we update a map.

There's some light refactoring here to stop using a global list of dynamic templates, and instead maintain a map of dynamic templates on the processor.

Why is it important?

As part of APM Server's migration to Fleet and data streams, we now duplicate fields for each data stream. We still need to generate legacy templates for 7.x, so we gather all of these data stream fields.yml files together to generate docs, templates, etc. The combined fields.yml will therefore have duplicate entries.

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

N/A

Related issues

elastic/apm-server#4576

In case of duplicate fields, do not generate duplicate
dynamic_template items. We already deduplicate field
mappings because we update a map.
@axw axw added bug v8.0.0 Team:Services (Deprecated) Label for the former Integrations-Services team v7.11.0 labels Dec 22, 2020
@axw axw requested a review from simitt December 22, 2020 10:12
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Dec 22, 2020
Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Collaborator

elasticmachine commented Dec 22, 2020

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Started by user Victor Martinez

  • Start Time: 2021-01-08T09:24:21.874+0000

  • Duration: 53 min 42 sec

Test stats 🧪

Test Results
Failed 0
Passed 17366
Skipped 1345
Total 18711

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 17366
Skipped 1345
Total 18711

@axw
Copy link
Member Author

axw commented Jan 12, 2021

@elastic/integrations-services can someone please review this? No great rush, it can slip to 7.12.

@axw axw merged commit c0bfea4 into elastic:master Feb 6, 2021
@axw axw deleted the template-duplicate-fields-dyntmpl branch February 6, 2021 00:50
@axw axw added the v7.12.0 label Feb 6, 2021
axw added a commit to axw/beats that referenced this pull request Feb 6, 2021
…ynamic templates (elastic#23240)

* libbeat/template: deduplicate dynamic templates

In case of duplicate fields, do not generate duplicate
dynamic_template items. We already deduplicate field
mappings because we update a map.

* libbeat/template: preserve dynamic template order

(cherry picked from commit c0bfea4)
@axw axw removed the v7.11.0 label Feb 8, 2021
@axw axw added the v7.11.0 label Feb 8, 2021
axw added a commit to axw/beats that referenced this pull request Feb 8, 2021
…ynamic templates (elastic#23240)

* libbeat/template: deduplicate dynamic templates

In case of duplicate fields, do not generate duplicate
dynamic_template items. We already deduplicate field
mappings because we update a map.

* libbeat/template: preserve dynamic template order

(cherry picked from commit c0bfea4)
axw added a commit that referenced this pull request Feb 24, 2021
…ynamic templates (#23240) (#23894)

* libbeat/template: deduplicate dynamic templates

In case of duplicate fields, do not generate duplicate
dynamic_template items. We already deduplicate field
mappings because we update a map.

* libbeat/template: preserve dynamic template order

(cherry picked from commit c0bfea4)
axw added a commit to axw/beats that referenced this pull request Feb 24, 2021
…ynamic templates (elastic#23240)

* libbeat/template: deduplicate dynamic templates

In case of duplicate fields, do not generate duplicate
dynamic_template items. We already deduplicate field
mappings because we update a map.

* libbeat/template: preserve dynamic template order

(cherry picked from commit c0bfea4)
axw added a commit that referenced this pull request Feb 24, 2021
…ynamic templates (#23240) (#24197)

* libbeat/template: deduplicate dynamic templates

In case of duplicate fields, do not generate duplicate
dynamic_template items. We already deduplicate field
mappings because we update a map.

* libbeat/template: preserve dynamic template order

(cherry picked from commit c0bfea4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Team:Services (Deprecated) Label for the former Integrations-Services team v7.11.0 v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants