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

Avoid modifications of base module host when building metricsets #20143

Closed
wants to merge 1 commit into from

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Jul 22, 2020

What does this PR do?

Avoid modifying the host in Metricbeat module builders.

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. Without this change we may lose information as the scheme (#16205), or some
other elements in the url (#19849) and parsers will fail or will generate incorrect host data
objects.

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 self-assigned this Jul 22, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 22, 2020
@jsoriano jsoriano added [zube]: In Review Metricbeat Metricbeat refactoring review Team:Services (Deprecated) Label for the former Integrations-Services team and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 22, 2020
Running the host parser in metricbeat modules modifies the host in the
base module, so host parser cannot be run a second time. Change builders
so they don't modify the host.
@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: [jsoriano commented: jenkins run the tests please]

  • Start Time: 2020-07-22T15:40:25.076+0000

  • Duration: 80 min 56 sec

Test stats 🧪

Test Results
Failed 14
Passed 3096
Skipped 667
Total 3777

Test errors

Expand to view the tests failures

  • Name: Build and Test / Metricbeat OSS Unit tests / test_process – test_system.Test

    • Age: 1
    • Duration: 1.168
    • Error Details: False is not true : fd not found in any process events
  • Name: Build and Test / Auditbeat x-pack / test_connected_udp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.033
    • 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.028
    • 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.031
    • 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.036
    • 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.026
    • 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.023
    • 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.121
    • 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.121
    • 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.119
    • 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.118
    • 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.111
    • 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.113
    • 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: 19 min 21 sec

    • Start Time: 2020-07-22T16:04:07.168+0000

    • log

  • Name: Mage build unitTest

    • Description: mage build unitTest

    • Duration: 6 min 55 sec

    • Start Time: 2020-07-22T16:04:03.346+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-22T16:59:52.588Z] + '[' -e /usr/local/bin/bash_standard_lib.sh ']'
[2020-07-22T16:59:52.588Z] + source /usr/local/bin/bash_standard_lib.sh
[2020-07-22T16:59:52.588Z] ++ readonly CACHE_DIR=/var/lib/jenkins/workspace/Beats_beats_PR-20143/.git-references
[2020-07-22T16:59:52.588Z] ++ CACHE_DIR=/var/lib/jenkins/workspace/Beats_beats_PR-20143/.git-references
[2020-07-22T16:59:52.588Z] ++ declare -a cloned_git_repos
[2020-07-22T16:59:52.588Z] + retry 3 curl -sSLo codecov https://codecov.io/bash
[2020-07-22T16:59:52.588Z] + local retries=3
[2020-07-22T16:59:52.588Z] + shift
[2020-07-22T16:59:52.588Z] + local count=0
[2020-07-22T16:59:52.588Z] + curl -sSLo codecov https://codecov.io/bash
[2020-07-22T16:59:52.847Z] + return 0
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=auditbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f auditbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=filebeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f filebeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=heartbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f heartbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=journalbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f journalbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=libbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f libbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=metricbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f metricbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=packetbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f packetbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:52.847Z] + for i in '"$@"'
[2020-07-22T16:59:52.847Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-07-22T16:59:52.847Z] + '[' -f winlogbeat/build/coverage/full.cov ']'
[2020-07-22T16:59:53.435Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats
[2020-07-22T16:59:53.763Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-22T16:59:53.775Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Lint
[2020-07-22T16:59:53.870Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-07-22T16:59:53.978Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-07-22T16:59:54.085Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-07-22T16:59:54.179Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-07-22T16:59:54.275Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-07-22T16:59:54.366Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-07-22T16:59:54.460Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-07-22T16:59:54.557Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-Windows
[2020-07-22T16:59:54.672Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-07-22T16:59:54.812Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-07-22T16:59:54.906Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-07-22T16:59:55.010Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-OSS-Python-Integration-tests
[2020-07-22T16:59:55.116Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests
[2020-07-22T16:59:55.227Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-07-22T16:59:55.627Z] + cat
[2020-07-22T16:59:55.627Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-22T16:59:55.627Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-22T17:00:03.766Z] runbld>>> runbld started
[2020-07-22T17:00:03.766Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-22T17:00:05.152Z] runbld>>> The following profiles matched the job 'Beats/beats/PR-20143' in order of occurrence in the config (last value wins).
[2020-07-22T17:00:06.527Z] runbld>>> Debug logging enabled.
[2020-07-22T17:00:06.527Z] runbld>>> Storing result
[2020-07-22T17:00:06.527Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-22T17:00:06.527Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200722170006-09510D3B
[2020-07-22T17:00:06.527Z] runbld>>> Adding system facts.
[2020-07-22T17:00:07.465Z] runbld>>> Adding vcs info for the latest commit:  35441bf1b305f268108fb312dd32b538a333ca59
[2020-07-22T17:00:07.465Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-22T17:00:07.465Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-22T17:00:07.465Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-22T17:00:07.465Z] Processing JUnit reports with runbld...
[2020-07-22T17:00:08.033Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-22T17:00:08.033Z] runbld>>> DURATION: 29ms
[2020-07-22T17:00:08.033Z] runbld>>> STDOUT: 40 bytes
[2020-07-22T17:00:08.033Z] runbld>>> STDERR: 49 bytes
[2020-07-22T17:00:08.033Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-22T17:00:08.033Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats
[2020-07-22T17:00:09.409Z] runbld>>> Storing build metadata: 
[2020-07-22T17:00:09.409Z] runbld>>> Adding test report.
[2020-07-22T17:00:09.409Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats
[2020-07-22T17:00:09.983Z] runbld>>> Found 81 test output files
[2020-07-22T17:00:10.549Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-07-22T17:00:10.549Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-07-22T17:00:10.549Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-07-22T17:00:10.808Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-07-22T17:00:10.808Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-07-22T17:00:10.808Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-07-22T17:00:10.808Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20143/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-07-22T17:00:11.377Z] runbld>>> Test output logs contained: Errors: 0 Failures: 14 Tests: 3777 Skipped: 475
[2020-07-22T17:00:11.636Z] runbld>>> Storing result
[2020-07-22T17:00:11.636Z] runbld>>> FAILURES: 14
[2020-07-22T17:00:14.924Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-22T17:00:14.924Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200722170006-09510D3B
[2020-07-22T17:00:14.924Z] runbld>>> Email notification disabled by environment variable.
[2020-07-22T17:00:14.924Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-22T17:00:20.432Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats_PR-20143
[2020-07-22T17:00:20.533Z] [INFO] getVaultSecret: Getting secrets
[2020-07-22T17:00:20.606Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-22T17:00:21.350Z] + chmod 755 generate-build-data.sh
[2020-07-22T17:00:21.350Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20143/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20143/runs/4 FAILURE 4796015
[2020-07-22T17:00:21.350Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20143/runs/4/steps/?limit=10000 -o steps-info.json
[2020-07-22T17:00:22.693Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20143/runs/4/tests/?status=FAILED -o tests-errors.json
[2020-07-22T17:00:22.943Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20143/runs/4/log/ -o pipeline-log.txt

@jsoriano jsoriano added test-plan Add this PR to be manual test plan [zube]: In Progress and removed [zube]: In Review review labels Jul 22, 2020
@jsoriano
Copy link
Member Author

jenkins run the tests please

@jsoriano
Copy link
Member Author

Discarding this PR by now, original issue fixed by #20149.

@jsoriano jsoriano closed this Jul 23, 2020
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 [zube]: In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lightweight modules parses hosts twice
2 participants