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

Call host parser only once when building light metricsets #20149

Merged
merged 4 commits into from
Jul 23, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Jul 22, 2020

What does this PR do?

Call host parser only once on Metricbeat light modules.

Why is it important?

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems as the ones described in #16205 and #19849.

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 (Covered by tests from Fix: don't miss address scheme #16205).
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

  • There should be no changes in addresses included in metricbeat events, check specially on modules using custom host parsers as the sql ones.
  • Check that steps described in Lightweight modules parses hosts twice #19849 don't cause any issue.

Related issues

Use cases

  • Implement light modules based on native modules with custom host parsers.

@jsoriano jsoriano added refactoring Metricbeat Metricbeat [zube]: In Progress test-plan Add this PR to be manual test plan Team:Services (Deprecated) Label for the former Integrations-Services team labels Jul 22, 2020
@jsoriano jsoriano self-assigned this Jul 22, 2020
@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 Jul 22, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 22, 2020

💔 Tests Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20149 updated, Started by user Victor Martinez, Rebuilds build #4]

  • Start Time: 2020-07-23T07:48:23.830+0000

  • Duration: 79 min 57 sec

Test stats 🧪

Test Results
Failed 13
Passed 4144
Skipped 925
Total 5082

Test errors

Expand to view the tests failures

  • Name: Build and Test / Auditbeat x-pack / test_connected_udp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.095
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_connected_udp_ipv6 – test_system_socket.Test

    • Age: 1
    • Duration: 60.093
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_enrichment – test_system_socket.Test

    • Age: 1
    • Duration: 60.095
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_long_request – test_system_socket.Test

    • Age: 1
    • Duration: 60.102
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_udp_ipv6 – test_system_socket.Test

    • Age: 1
    • Duration: 60.096
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_unidirectional_udp – test_system_socket.Test

    • Age: 1
    • Duration: 60.091
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_multi_udp_upv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.096
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_no_dns_enrichment – test_system_socket.Test

    • Age: 1
    • Duration: 60.087
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_tcp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.095
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_tcp_ipv6_disabled – test_system_socket.Test

    • Age: 1
    • Duration: 60.103
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_udp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.095
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_udp_ipv6 – test_system_socket.Test

    • Age: 1
    • Duration: 60.088
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_udp_ipv6_disabled – test_system_socket.Test

    • Age: 1
    • Duration: 60.098
    • Error Details: Expected exit code to be 0, but it was 1

Steps errors

Expand to view the steps failures

  • Name: Mage update build test

    • Description: mage update build test

    • Duration: 19 min 2 sec

    • Start Time: 2020-07-23T08:11:57.985+0000

    • log

  • Name: Install docker-compose 1.21.0

    • Description: .ci/scripts/install-docker-compose.sh

    • Duration: 1 min 33 sec

    • Start Time: 2020-07-23T08:11:51.544+0000

    • log

  • Name: Notifies GitHub of the status of a Pull Request

    • Description: The supplied credentials are invalid to login

    • Duration: 0 min 0 sec

    • Start Time: 2020-07-23T08:14:59.883+0000

    • log

  • Name: Notifies GitHub of the status of a Pull Request

    • Description:

    • Duration: 0 min 0 sec

    • Start Time: 2020-07-23T08:15:00.143+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-23T09:06:54.446Z] ++ CACHE_DIR=/var/lib/jenkins/workspace/Beats_beats_PR-20149/.git-references
[2020-07-23T09:06:54.446Z] ++ declare -a cloned_git_repos
[2020-07-23T09:06:54.446Z] + retry 3 curl -sSLo codecov https://codecov.io/bash
[2020-07-23T09:06:54.446Z] + local retries=3
[2020-07-23T09:06:54.446Z] + shift
[2020-07-23T09:06:54.446Z] + local count=0
[2020-07-23T09:06:54.446Z] + curl -sSLo codecov https://codecov.io/bash
[2020-07-23T09:06:54.711Z] + return 0
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=auditbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f auditbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=filebeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f filebeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=heartbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f heartbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=journalbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f journalbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=libbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f libbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=metricbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f metricbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=packetbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f packetbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:54.711Z] + for i in '"$@"'
[2020-07-23T09:06:54.711Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-07-23T09:06:54.711Z] + '[' -f winlogbeat/build/coverage/full.cov ']'
[2020-07-23T09:06:55.281Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats
[2020-07-23T09:06:55.594Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-23T09:06:55.605Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Lint
[2020-07-23T09:06:55.691Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-07-23T09:06:55.774Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-07-23T09:06:55.852Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-07-23T09:06:55.935Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-07-23T09:06:56.015Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-07-23T09:06:56.098Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-07-23T09:06:56.187Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-07-23T09:06:56.276Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-07-23T09:06:56.367Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-Windows
[2020-07-23T09:06:56.466Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-07-23T09:06:56.545Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-07-23T09:06:56.644Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-07-23T09:06:56.740Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-07-23T09:06:56.826Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-07-23T09:06:56.910Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-OSS-Python-Integration-tests
[2020-07-23T09:06:57.002Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests
[2020-07-23T09:06:57.081Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-07-23T09:06:57.453Z] + cat
[2020-07-23T09:06:57.453Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-23T09:06:57.453Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-23T09:07:04.065Z] runbld>>> runbld started
[2020-07-23T09:07:04.065Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-23T09:07:05.002Z] runbld>>> The following profiles matched the job 'Beats/beats/PR-20149' in order of occurrence in the config (last value wins).
[2020-07-23T09:07:06.379Z] runbld>>> Debug logging enabled.
[2020-07-23T09:07:06.379Z] runbld>>> Storing result
[2020-07-23T09:07:06.638Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-23T09:07:06.638Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200723090706-EAEEDAE6
[2020-07-23T09:07:06.638Z] runbld>>> Adding system facts.
[2020-07-23T09:07:07.583Z] runbld>>> Adding vcs info for the latest commit:  c8b00b66229c4238d1a59dd2da02b20a7c3528e2
[2020-07-23T09:07:07.583Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-23T09:07:07.583Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-23T09:07:07.583Z] Processing JUnit reports with runbld...
[2020-07-23T09:07:07.583Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-23T09:07:07.842Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-23T09:07:07.842Z] runbld>>> DURATION: 33ms
[2020-07-23T09:07:07.842Z] runbld>>> STDOUT: 40 bytes
[2020-07-23T09:07:07.842Z] runbld>>> STDERR: 49 bytes
[2020-07-23T09:07:07.842Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-23T09:07:07.842Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats
[2020-07-23T09:07:09.223Z] runbld>>> Storing build metadata: 
[2020-07-23T09:07:09.223Z] runbld>>> Adding test report.
[2020-07-23T09:07:09.223Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats
[2020-07-23T09:07:09.790Z] runbld>>> Found 89 test output files
[2020-07-23T09:07:10.358Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-07-23T09:07:10.358Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-07-23T09:07:10.358Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-07-23T09:07:10.358Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-07-23T09:07:10.358Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-07-23T09:07:10.617Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-07-23T09:07:10.617Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20149/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-07-23T09:07:11.186Z] runbld>>> Test output logs contained: Errors: 0 Failures: 13 Tests: 5082 Skipped: 707
[2020-07-23T09:07:11.186Z] runbld>>> Storing result
[2020-07-23T09:07:11.186Z] runbld>>> FAILURES: 13
[2020-07-23T09:07:13.720Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-23T09:07:13.720Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200723090706-EAEEDAE6
[2020-07-23T09:07:13.978Z] runbld>>> Email notification disabled by environment variable.
[2020-07-23T09:07:13.978Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-23T09:07:20.051Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats_PR-20149
[2020-07-23T09:07:20.417Z] [INFO] getVaultSecret: Getting secrets
[2020-07-23T09:07:20.524Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-23T09:07:21.510Z] + chmod 755 generate-build-data.sh
[2020-07-23T09:07:21.510Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20149/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20149/runs/5 FAILURE 4737419
[2020-07-23T09:07:21.510Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20149/runs/5/steps/?limit=10000 -o steps-info.json
[2020-07-23T09:07:25.634Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20149/runs/5/tests/?status=FAILED -o tests-errors.json
[2020-07-23T09:07:28.862Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20149/runs/5/log/ -o pipeline-log.txt

@sayden
Copy link
Contributor

sayden commented Jul 22, 2020

It LGTM. I know this is a draft but I just wanted to understand how this small piece works:

		// At this point host parser was already run, we need to run this again
		// Run the host parser if there was any
		// with the overriden defaults

The really confusing part for me is the "overriden defaults". That's why I didn't touch it myself to change it. Can you elaborate briefly what does it mean?

Because it seems obvious that, in the past, we were running host parser twice on purpose for some reason. My question is why Beats did it a bit more complicated in the past (running hostparser twice) when we could do it in a straightforward way (this PR). I mean, maybe we are missing something in this PR that may break if we merge it into Beats

@sayden
Copy link
Contributor

sayden commented Jul 22, 2020

I'll also summon @mtojek in case he can spend few minutes peeking around this, as it was related with something he needed and he may realize of something

@jsoriano
Copy link
Member Author

@sayden let me try to explain all this 🙂

Metricbeat module builder calls the host parser if the registration has anyone defined, here:

registration, err := r.metricSetRegistration(bm.Module().Name(), bm.Name())
if err != nil {
errs = append(errs, err)
continue
}
bm.registration = registration
bm.hostData = HostData{URI: bm.host}
if registration.HostParser != nil {
bm.hostData, err = registration.HostParser(bm.Module(), bm.host)
if err != nil {
errs = append(errs, errors.Wrapf(err, "host parsing failed for %v-%v",
bm.Module().Name(), bm.Name()))
continue
}
bm.host = bm.hostData.Host
}

Lightweight metricsets are not registered. When needed, they create a registration based on the registration of the metricset they are based on, here:

registration, err := r.metricSetRegistration(m.Input.Module, m.Input.MetricSet)

Then on this registration we replace some things:

  • The Factory, to override the defaults and some things in the base module as the name and so on. And then call the original factory to setup the metricset.
  • IsDefault, to indicate if the metricset is a default one.

("Overriding the defaults" on this context is to use the defaults included in the manifest.yml, so default settings in the module are updated with default settings in the manifest.yml, and they will be updated with the user-defined configuration when building the metricset.)

On the initial implementation we found that host parsers can use other settings apart of host to build the host data, and some of these settings make sense in a light module. For example ParseURL can use other settings like username, password, query or path. It can make sense to define a default path in a manifest.yml, but the host parser is called before the factory, before the overrides we do for light modules. So I added the second call to the host parser so settings in the manifest.yml are taken into account for the final host data. At this point I should have done a change like the one of this PR instead of adding the second call, but I didn't foresee the problems then, and I was trying to override the less things I could.

This seemed to work, till @mtojek found that the scheme got lost, the problem is that information in host can get lost after parsing it, because we are replacing the host value after calling the host parser:

bm.host = bm.hostData.Host

So the second call to the host parser could be missing some of the original configuration. Then he added #16205 to workaround this specific issue with the scheme, and it worked well for all our current cases because they use in general normal URLs. Now you have found another case that doesn't work.

On this PR I am removing Marcin's change, but I am not touching his tests, so in principle this should work as he expected. I will add him to the review in any case.

@jsoriano jsoriano requested review from mtojek and sayden July 22, 2020 19:16
@jsoriano jsoriano added the needs_backport PR is waiting to be backported to other branches. label Jul 22, 2020
@jsoriano jsoriano marked this pull request as ready for review July 22, 2020 19:17
@elasticmachine
Copy link
Collaborator

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

@jsoriano jsoriano changed the title Call host parser only once Call host parser only once when building light metricsets Jul 22, 2020
Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

Understood. Now it makes more sense in my head. Really appreciated.

Change LGMT

@jsoriano
Copy link
Member Author

Failures in auditbeat are also happening in master.

@jsoriano jsoriano deleted the mb-light-modules-host-parser-once branch July 23, 2020 11:36
@jsoriano jsoriano added v7.10.0 and removed needs_backport PR is waiting to be backported to other branches. labels Jul 23, 2020
jsoriano added a commit to jsoriano/beats that referenced this pull request Jul 23, 2020
)

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems.

This change disables host parser in the registration created for light modules, and makes
only the "second call" inside the factory.

It also removes previous fix for URLs as it shouldn't be needed anymore.

(cherry picked from commit 6c82292)
jsoriano added a commit to jsoriano/beats that referenced this pull request Jul 23, 2020
)

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems.

This change disables host parser in the registration created for light modules, and makes
only the "second call" inside the factory.

It also removes previous fix for URLs as it shouldn't be needed anymore.

(cherry picked from commit 6c82292)
jsoriano added a commit that referenced this pull request Jul 24, 2020
…20189)

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems.

This change disables host parser in the registration created for light modules, and makes
only the "second call" inside the factory.

It also removes previous fix for URLs as it shouldn't be needed anymore.

(cherry picked from commit 6c82292)
jsoriano added a commit that referenced this pull request Jul 24, 2020
…20190)

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems.

This change disables host parser in the registration created for light modules, and makes
only the "second call" inside the factory.

It also removes previous fix for URLs as it shouldn't be needed anymore.

(cherry picked from commit 6c82292)
v1v added a commit to v1v/beats that referenced this pull request Jul 27, 2020
…ne-2.0

* upstream/master: (41 commits)
  adding possibility to override content-type checks, it was breaking certain webhooks that is not able to set content-headers at all. Still defaults to application/json (elastic#20232)
  fix: use a fixed worker type for tests (elastic#20130)
  [Ingest Manager] Prepare packaging for endpoint and asc files (elastic#20186)
  [Packetbeat] HTTP: Improve support for 100-continue elastic#15830 (elastic#19349)
  Increase index.max_docvalue_fields_search to 200 (elastic#20218)
  [Ingest Manager] Prevent closing closed reader (elastic#20214)
  [Metricbeat] Use MySQL Host Parser in Query metricset (elastic#20191)
  Testing: Ignore timestamp from cylance/protect dataset (elastic#20211)
  [Filebeat] Ignore cylance.protect timestamps while testing (elastic#20207)
  [CI] remove codecov step (elastic#20102)
  [docs] Indicate that SYSTEM user is required on Windows to use Endpoint (elastic#20172)
  Remove f5/firepass rsa2elk fileset (elastic#20160)
  [Elastic Agent] Improve GRPC stop to be more relaxed. (elastic#20118)
  Fix fileset field prefixing (elastic#20170)
  Fix terminating pod autodiscover issue (elastic#20084)
  Call host parser only once when building light metricsets (elastic#20149)
  [CI] fix null string with contains (elastic#20182)
  [Ingest Manager] Fix failing unit tests on windows (elastic#20127)
  [Filebeat] Update crowdstrike module (elastic#20138)
  [docs] Add x-pack role to relevant metricsets (elastic#20167)
  ...
v1v added a commit to v1v/beats that referenced this pull request Jul 29, 2020
* upstream/7.9: (32 commits)
  feat(ci): support storing artifacts for PRs in separate dirs (elastic#20282) (elastic#20301)
  Cisco ASA: Fix message 106100 (elastic#20245) (elastic#20277)
  [CI] Change upstream reference (elastic#20296) (elastic#20297)
  [docs] Fix Windows download link for agent (elastic#20258) (elastic#20290)
  Cherry-pick to 7.9: [docs] Rename release highlights to what's new (elastic#20255) (elastic#20285)
  Elastic agent on k8s (elastic#19727) (elastic#20262)
  [Filebeat Module] Defender ATP - Adding dashboard (elastic#20058) (elastic#20093)
  fix: use a fixed worker type for tests (elastic#20130) (elastic#20247)
  [Elastic Agent] Fix Windows powershell install service script (elastic#20203) (elastic#20252)
  [Ingest Manager] Fixed unzip on older windows  (elastic#20088) (elastic#20109)
  adding possibility to override content-type checks, it was breaking certain webhooks that is not able to set content-headers at all. Still defaults to application/json (elastic#20232) (elastic#20237)
  [Filebeat][Gsuite] Make GSuite docs more clear (elastic#19981) (elastic#20067)
  Increase index.max_docvalue_fields_search to 200 (elastic#20218) (elastic#20221)
  Call host parser only once when building light metricsets (elastic#20149) (elastic#20190)
  [Metricbeat] Use MySQL Host Parser in Query metricset (elastic#20191) (elastic#20212)
  [Filebeat] Ignore cylance.protect timestamps while testing (elastic#20207) (elastic#20217)
  [libbeat] Fix write error in ensureWriter.Write (elastic#20112) (elastic#20145)
  Cherry-pick elastic#20127 to 7.9: Fix failing unit tests on windows  (elastic#20180)
  Remove f5/firepass rsa2elk fileset (elastic#20160) (elastic#20206)
  Cherry-pick elastic#20138 to 7.9: [Filebeat] Update crowdstrike module (elastic#20177)
  ...
@andresrc andresrc added the test-plan-added This PR has been added to the test plan label Oct 3, 2020
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
)

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems.

This change disables host parser in the registration created for light modules, and makes
only the "second call" inside the factory.

It also removes previous fix for URLs as it shouldn't be needed anymore.
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
) (elastic#20190)

When using light modules, host parser is called twice. First by the actual implementation
of the metricset, and second after adding the configuration defined in the light module
manifest. Second call might be missing data as the original host is modified after the first
call, causing problems.

This change disables host parser in the registration created for light modules, and makes
only the "second call" inside the factory.

It also removes previous fix for URLs as it shouldn't be needed anymore.

(cherry picked from commit 57d1265)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metricbeat Metricbeat refactoring Team:Services (Deprecated) Label for the former Integrations-Services team test-plan Add this PR to be manual test plan test-plan-added This PR has been added to the test plan v7.9.0 v7.10.0 [zube]: In Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lightweight modules parses hosts twice
5 participants