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

Cherry-pick #20149 to 7.9: Call host parser only once when building light metricsets #20190

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Jul 23, 2020

Cherry-pick of PR #20149 to 7.9 branch. Original message:

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.

)

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 jsoriano added [zube]: In Review backport Team:Services (Deprecated) Label for the former Integrations-Services team labels Jul 23, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 23, 2020
@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 23, 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.

LGTM

@elasticmachine
Copy link
Collaborator

💔 Tests Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20190 opened]

  • Start Time: 2020-07-23T11:40:28.841+0000

  • Duration: 116 min 42 sec

Test stats 🧪

Test Results
Failed 13
Passed 3968
Skipped 877
Total 4858

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.125
    • 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.126
    • 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.112
    • 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.132
    • 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.107
    • 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.113
    • 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.122
    • 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.109
    • 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.135
    • 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.107
    • 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.117
    • 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.132
    • 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.113
    • 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: 22 min 45 sec

    • Start Time: 2020-07-23T12:03:47.066+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-23T13:35:15.855Z] + FILE=libbeat/build/coverage/full.cov
[2020-07-23T13:35:15.855Z] + '[' -f libbeat/build/coverage/full.cov ']'
[2020-07-23T13:35:15.855Z] + for i in '"$@"'
[2020-07-23T13:35:15.855Z] + FILE=metricbeat/build/coverage/full.cov
[2020-07-23T13:35:15.855Z] + '[' -f metricbeat/build/coverage/full.cov ']'
[2020-07-23T13:35:15.855Z] + for i in '"$@"'
[2020-07-23T13:35:15.855Z] + FILE=packetbeat/build/coverage/full.cov
[2020-07-23T13:35:15.855Z] + '[' -f packetbeat/build/coverage/full.cov ']'
[2020-07-23T13:35:15.855Z] + for i in '"$@"'
[2020-07-23T13:35:15.855Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-07-23T13:35:15.855Z] + '[' -f winlogbeat/build/coverage/full.cov ']'
[2020-07-23T13:35:17.714Z] Post stage
[2020-07-23T13:35:17.744Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats
[2020-07-23T13:35:18.804Z] Starting "default"...
[2020-07-23T13:35:18.804Z] Machine "default" is already running.
[2020-07-23T13:35:20.351Z] Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.102:2376": dial tcp 192.168.99.102:2376: connect: connection refused
[2020-07-23T13:35:20.351Z] You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
[2020-07-23T13:35:20.351Z] Be advised that this will trigger a Docker daemon restart which might stop running containers.
[2020-07-23T13:35:20.351Z] 
[2020-07-23T13:35:20.351Z] Client:
[2020-07-23T13:35:20.351Z]  Version:           18.06.1-ce
[2020-07-23T13:35:20.351Z]  API version:       1.38
[2020-07-23T13:35:20.351Z]  Go version:        go1.10.3
[2020-07-23T13:35:20.351Z]  Git commit:        e68fc7a
[2020-07-23T13:35:20.351Z]  Built:             Tue Aug 21 17:21:31 2018
[2020-07-23T13:35:20.351Z]  OS/Arch:           darwin/amd64
[2020-07-23T13:35:20.351Z]  Experimental:      false
[2020-07-23T13:35:20.351Z] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[2020-07-23T13:35:20.351Z] It requires Docker daemon to be installed and running
[2020-07-23T13:35:41.289Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats
[2020-07-23T13:35:41.644Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-23T13:35:41.721Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Lint
[2020-07-23T13:35:41.904Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-07-23T13:35:42.091Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-07-23T13:35:42.265Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-07-23T13:35:42.442Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-07-23T13:35:42.623Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-07-23T13:35:42.789Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-07-23T13:35:42.952Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-07-23T13:35:43.115Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-07-23T13:35:43.298Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-07-23T13:35:43.465Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-07-23T13:35:43.625Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-07-23T13:35:43.784Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-07-23T13:35:43.956Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-Windows
[2020-07-23T13:35:44.116Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-07-23T13:35:44.277Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-07-23T13:35:44.456Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-07-23T13:35:44.622Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-07-23T13:35:44.786Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-07-23T13:35:44.951Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Generators-Metricbeat-Mac-OS-X
[2020-07-23T13:35:45.139Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Generators-Beat-Mac-OS-X
[2020-07-23T13:35:45.597Z] + cat
[2020-07-23T13:35:45.597Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-23T13:35:45.597Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-23T13:35:52.244Z] runbld>>> runbld started
[2020-07-23T13:35:52.244Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-23T13:35:53.888Z] runbld>>> The following profiles matched the job 'Beats/beats/PR-20190' in order of occurrence in the config (last value wins).
[2020-07-23T13:35:55.293Z] runbld>>> Debug logging enabled.
[2020-07-23T13:35:55.293Z] runbld>>> Storing result
[2020-07-23T13:35:55.556Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-23T13:35:55.556Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200723133555-43F3EF58
[2020-07-23T13:35:55.556Z] runbld>>> Adding system facts.
[2020-07-23T13:35:56.501Z] runbld>>> Adding vcs info for the latest commit:  fdd5b7fc3bbabe37d1df2615c2bbbb7c394cbb2e
[2020-07-23T13:35:56.501Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-23T13:35:56.501Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-23T13:35:56.767Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-23T13:35:56.767Z] Processing JUnit reports with runbld...
[2020-07-23T13:35:57.029Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-23T13:35:57.029Z] runbld>>> DURATION: 18ms
[2020-07-23T13:35:57.029Z] runbld>>> STDOUT: 40 bytes
[2020-07-23T13:35:57.029Z] runbld>>> STDERR: 49 bytes
[2020-07-23T13:35:57.029Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-23T13:35:57.029Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats
[2020-07-23T13:35:58.417Z] runbld>>> Storing build metadata: 
[2020-07-23T13:35:58.417Z] runbld>>> Adding test report.
[2020-07-23T13:35:58.417Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats
[2020-07-23T13:35:58.994Z] runbld>>> Found 86 test output files
[2020-07-23T13:35:59.576Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-07-23T13:35:59.576Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-07-23T13:35:59.576Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-07-23T13:35:59.576Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-07-23T13:35:59.576Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-07-23T13:36:00.150Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-07-23T13:36:00.150Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20190/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-07-23T13:36:00.410Z] runbld>>> Test output logs contained: Errors: 0 Failures: 13 Tests: 4858 Skipped: 669
[2020-07-23T13:36:00.672Z] runbld>>> Storing result
[2020-07-23T13:36:00.672Z] runbld>>> FAILURES: 13
[2020-07-23T13:36:03.222Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-23T13:36:03.222Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200723133555-43F3EF58
[2020-07-23T13:36:03.483Z] runbld>>> Email notification disabled by environment variable.
[2020-07-23T13:36:03.483Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-23T13:36:09.955Z] Running on worker-395930 in /var/lib/jenkins/workspace/Beats_beats_PR-20190
[2020-07-23T13:36:10.107Z] [INFO] getVaultSecret: Getting secrets
[2020-07-23T13:36:10.223Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-23T13:36:12.701Z] + chmod 755 generate-build-data.sh
[2020-07-23T13:36:12.701Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20190/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20190/runs/1 FAILURE 6942416
[2020-07-23T13:36:12.701Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20190/runs/1/steps/?limit=10000 -o steps-info.json
[2020-07-23T13:36:14.192Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20190/runs/1/tests/?status=FAILED -o tests-errors.json
[2020-07-23T13:36:15.664Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20190/runs/1/log/ -o pipeline-log.txt

@jsoriano jsoriano merged commit e2ff940 into elastic:7.9 Jul 24, 2020
@jsoriano jsoriano deleted the backport_20149_7.9 branch July 24, 2020 11:11
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)
  ...
@zube zube bot removed the [zube]: Done label Oct 22, 2020
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
backport Team:Services (Deprecated) Label for the former Integrations-Services team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants