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 #19181 to 7.x: Cache error responses for cloudfoundry apps metadata #19638

Merged
merged 1 commit into from
Jul 6, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Jul 3, 2020

Cherry-pick of PR #19181 to 7.x branch. Original message:

What does this PR do?

Cache error responses when requesting Cloud Foundry apps metadata to
avoid hitting continuously the API when there are failures.

The original motivation for this change was to handle AppNotFound errors,
but the truth is that continuously retrying on any error is not very good, so
this change effectively introduces a delay between retries on any error from
the API. It looks safer by now. We can reconsider this in the future if we see
that some other error should be handled in a different way.

An specific flag cache_retry_delay is also added to configure how long Beats
should wait before retrying again in case of error.

Why is it important?

Sometimes events are received for apps that cannot be found on the API, on
these cases Beats continuously hit the API to try to get the metadata. This
provokes unnecessary load on API servers of big deployments.

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.

Cache error responses when requesting Cloud Foundry apps metadata to
avoid hitting continuously the API when there are missing applications.

(cherry picked from commit 9c0b63d)
@jsoriano jsoriano added [zube]: In Review backport Team:Platforms Label for the Integrations - Platforms team labels Jul 3, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@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 3, 2020
@jsoriano jsoriano self-assigned this Jul 3, 2020
@elasticmachine
Copy link
Collaborator

❕ Build Aborted

Either there was a build timeout or someone aborted the build.'}

Pipeline View Test View Changes Artifacts

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19638 opened]

  • Start Time: 2020-07-03T11:29:43.451+0000

  • Duration: 127 min 34 sec

Test stats 🧪

Test Results
Failed 0
Passed 3837
Skipped 525
Total 4362

Steps errors

Expand to view the steps failures

  • Name: Report to Codecov
    • Description: curl -sSLo codecov https://codecov.io/bash for i in auditbeat filebeat heartbeat libbeat metricbeat packetbeat winlogbeat journalbeat do FILE="${i}/build/coverage/full.cov" if [ -f "${FILE}" ]; then bash codecov -f "${FILE}" fi done

    • Duration: 1 min 27 sec

    • Start Time: 2020-07-03T12:03:44.709+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-03T12:46:22.865Z] + FILE=metricbeat/build/coverage/full.cov
[2020-07-03T12:46:22.865Z] + [ -f metricbeat/build/coverage/full.cov ]
[2020-07-03T12:46:22.865Z] + FILE=packetbeat/build/coverage/full.cov
[2020-07-03T12:46:22.865Z] + [ -f packetbeat/build/coverage/full.cov ]
[2020-07-03T12:46:22.865Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-07-03T12:46:22.865Z] + [ -f winlogbeat/build/coverage/full.cov ]
[2020-07-03T12:46:22.865Z] + FILE=journalbeat/build/coverage/full.cov
[2020-07-03T12:46:22.865Z] + [ -f journalbeat/build/coverage/full.cov ]
[2020-07-03T13:35:27.484Z] Cancelling nested steps due to timeout
[2020-07-03T13:35:27.489Z] .......Sending interrupt signal to process
[2020-07-03T13:35:30.126Z] Sending interrupt signal to process
[2020-07-03T13:35:45.047Z] failed to run compiled magefile: signal: terminated
[2020-07-03T13:35:45.056Z] script returned exit code 255
[2020-07-03T13:35:45.214Z] Recording test results
[2020-07-03T13:35:47.089Z] Stashed 3 file(s)
[2020-07-03T13:35:47.108Z] Archiving artifacts
[2020-07-03T13:35:48.063Z] + curl -sSLo codecov https://codecov.io/bash
[2020-07-03T13:35:48.324Z] + FILE=auditbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f auditbeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=filebeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f filebeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=heartbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f heartbeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=libbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f libbeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=metricbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f metricbeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=packetbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f packetbeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f winlogbeat/build/coverage/full.cov ]
[2020-07-03T13:35:48.324Z] + FILE=journalbeat/build/coverage/full.cov
[2020-07-03T13:35:48.324Z] + [ -f journalbeat/build/coverage/full.cov ]
[2020-07-03T13:35:49.845Z] Failed in branch Filebeat x-pack
[2020-07-03T13:35:51.473Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats
[2020-07-03T13:35:51.808Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-03T13:35:51.831Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Lint
[2020-07-03T13:35:51.980Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-07-03T13:35:52.128Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Dockerlogbeat
[2020-07-03T13:35:52.279Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-07-03T13:35:52.426Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-07-03T13:35:52.575Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-07-03T13:35:52.723Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-07-03T13:35:52.869Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-07-03T13:35:53.018Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-07-03T13:35:53.164Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Libbeat-x-pack
[2020-07-03T13:35:53.313Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-07-03T13:35:53.460Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-07-03T13:35:53.607Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Functionbeat-Mac-OS-X-x-pack
[2020-07-03T13:35:53.755Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-07-03T13:35:53.910Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-07-03T13:35:54.059Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-07-03T13:35:54.208Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Functionbeat-Windows
[2020-07-03T13:35:54.355Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-07-03T13:35:54.504Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Filebeat-x-pack
[2020-07-03T13:35:54.937Z] + cat
[2020-07-03T13:35:54.937Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-03T13:35:54.937Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-03T13:36:01.556Z] runbld>>> runbld started
[2020-07-03T13:36:01.556Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-03T13:36:04.106Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-19638' in order of occurrence in the config (last value wins).
[2020-07-03T13:36:05.050Z] runbld>>> Debug logging enabled.
[2020-07-03T13:36:05.050Z] runbld>>> Storing result
[2020-07-03T13:36:05.312Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-03T13:36:05.312Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200703133604-1D57A6F8
[2020-07-03T13:36:05.312Z] runbld>>> Adding system facts.
[2020-07-03T13:36:06.256Z] runbld>>> Adding vcs info for the latest commit:  e8c1a2facb8040c69144cf5cfbf314cdce9d07cf
[2020-07-03T13:36:06.256Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-03T13:36:06.256Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-03T13:36:06.256Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-03T13:36:06.256Z] Processing JUnit reports with runbld...
[2020-07-03T13:36:06.518Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-03T13:36:06.518Z] runbld>>> DURATION: 11ms
[2020-07-03T13:36:06.518Z] runbld>>> STDOUT: 40 bytes
[2020-07-03T13:36:06.518Z] runbld>>> STDERR: 49 bytes
[2020-07-03T13:36:06.518Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-03T13:36:06.518Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats
[2020-07-03T13:36:07.914Z] runbld>>> Storing build metadata: 
[2020-07-03T13:36:07.914Z] runbld>>> Adding test report.
[2020-07-03T13:36:07.914Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats
[2020-07-03T13:36:08.488Z] runbld>>> Found 49 test output files
[2020-07-03T13:36:09.063Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-07-03T13:36:09.063Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-07-03T13:36:09.063Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-07-03T13:36:09.063Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-07-03T13:36:09.063Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-07-03T13:36:09.636Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 4212 Skipped: 475
[2020-07-03T13:36:09.636Z] runbld>>> Storing result
[2020-07-03T13:36:09.636Z] runbld>>> FAILURES: 0
[2020-07-03T13:36:09.897Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-03T13:36:09.897Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200703133604-1D57A6F8
[2020-07-03T13:36:10.159Z] runbld>>> Email notification disabled by environment variable.
[2020-07-03T13:36:10.159Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-03T13:36:16.014Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19638
[2020-07-03T13:36:16.298Z] [INFO] getVaultSecret: Getting secrets
[2020-07-03T13:36:16.370Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-03T13:36:17.396Z] + chmod 755 generate-build-data.sh
[2020-07-03T13:36:17.396Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19638/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19638/runs/1 ABORTED 7593674
[2020-07-03T13:36:17.396Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19638/runs/1/steps/?limit=10000 -o steps-info.json
[2020-07-03T13:36:18.307Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19638/runs/1/tests/?status=FAILED -o tests-errors.json

Copy link
Contributor

@narph narph left a comment

Choose a reason for hiding this comment

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

LGTM

@jsoriano jsoriano merged commit 6b50d97 into elastic:7.x Jul 6, 2020
@jsoriano jsoriano deleted the backport_19181_7.x branch July 6, 2020 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Platforms Label for the Integrations - Platforms team [zube]: Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants