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

Add a persistent cache for cloudfoundry metadata #20739

Closed
wants to merge 14 commits into from

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Aug 21, 2020

What does this PR do?

Add a persistent cache on disk for Cloudfoundry metadata, based on the statestore.

Why is it important?

Improve restart of beats when monitoring very big Cloudfoundry 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.

Author's Checklist

  • Review performance, make obvious optimizations.
  • Review encoding used to store structures.
    • Why custom labels are not being used when marshalling to JSON?
  • Cache should be closed at some moment.
  • Review error handling when key is missing vs. actual error.
  • Add settings to make it optional?
  • Use different store names for different Cloudfoundry deployments, to support monitoring multiple clusters from the same Beat (maybe not needed because it is difficult to have uuid collisions).
  • When ready, separate in two PRs, one for the persistent cache, and another one for the change in add_cloudfoundry_metadata.

How to test this PR locally

  • Use add_cloudfoundry_metadata with Filebeat or Metricbeat.
  • Restart the Beat.
  • The Beat should reuse information on disk to enrich events without querying cloudfoundry API.

Related issues

@jsoriano jsoriano added in progress Pull request is currently in progress. Team:Services (Deprecated) Label for the former Integrations-Services team Team:Platforms Label for the Integrations - Platforms team labels Aug 21, 2020
@jsoriano jsoriano self-assigned this Aug 21, 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 Aug 21, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 21, 2020

💔 Build Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20739 updated]

  • Start Time: 2020-08-25T08:33:59.809+0000

  • Duration: 8 min 22 sec

Steps errors

Expand to view the steps failures

  • Name: Make check
    • Description: make check

    • Duration: 1 min 33 sec

    • Start Time: 2020-08-25T08:41:00.394+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-08-25T08:41:41.468Z] Failed in branch Elastic Agent x-pack Windows
[2020-08-25T08:41:41.469Z] Failed in branch Elastic Agent Mac OS X
[2020-08-25T08:41:41.469Z] Failed in branch Filebeat oss
[2020-08-25T08:41:41.470Z] Failed in branch Filebeat x-pack
[2020-08-25T08:41:41.471Z] Failed in branch Filebeat Mac OS X
[2020-08-25T08:41:41.471Z] Failed in branch Filebeat x-pack Mac OS X
[2020-08-25T08:41:41.472Z] Failed in branch Filebeat Windows
[2020-08-25T08:41:41.472Z] Failed in branch Filebeat x-pack Windows
[2020-08-25T08:41:41.473Z] Failed in branch Heartbeat oss
[2020-08-25T08:41:41.473Z] Failed in branch Heartbeat Mac OS X
[2020-08-25T08:41:41.474Z] Failed in branch Heartbeat Windows
[2020-08-25T08:41:41.475Z] Failed in branch Auditbeat oss Linux
[2020-08-25T08:41:41.475Z] Failed in branch Auditbeat crosscompile
[2020-08-25T08:41:41.476Z] Failed in branch Auditbeat oss Mac OS X
[2020-08-25T08:41:41.476Z] Failed in branch Auditbeat oss Windows
[2020-08-25T08:41:41.477Z] Failed in branch Auditbeat x-pack
[2020-08-25T08:41:41.477Z] Failed in branch Auditbeat x-pack Mac OS X
[2020-08-25T08:41:41.478Z] Failed in branch Auditbeat x-pack Windows
[2020-08-25T08:41:41.478Z] Failed in branch Libbeat x-pack
[2020-08-25T08:41:41.479Z] Failed in branch Metricbeat OSS Unit tests
[2020-08-25T08:41:41.480Z] Failed in branch Metricbeat OSS Go Integration tests
[2020-08-25T08:41:41.480Z] Failed in branch Metricbeat OSS Python Integration tests
[2020-08-25T08:41:41.481Z] Failed in branch Metricbeat crosscompile
[2020-08-25T08:41:41.481Z] Failed in branch Metricbeat Mac OS X
[2020-08-25T08:41:41.482Z] Failed in branch Metricbeat x-pack Mac OS X
[2020-08-25T08:41:41.482Z] Failed in branch Metricbeat Windows
[2020-08-25T08:41:41.483Z] Failed in branch Metricbeat x-pack Windows
[2020-08-25T08:41:41.484Z] Failed in branch Packetbeat Linux
[2020-08-25T08:41:41.484Z] Failed in branch Packetbeat Mac OS X
[2020-08-25T08:41:41.485Z] Failed in branch Packetbeat Windows
[2020-08-25T08:41:41.485Z] Failed in branch dockerlogbeat
[2020-08-25T08:41:41.486Z] Failed in branch Winlogbeat oss
[2020-08-25T08:41:41.487Z] Failed in branch Winlogbeat Windows
[2020-08-25T08:41:41.487Z] Failed in branch Winlogbeat Windows x-pack
[2020-08-25T08:41:41.488Z] Failed in branch Functionbeat x-pack
[2020-08-25T08:41:41.488Z] Failed in branch Functionbeat Mac OS X x-pack
[2020-08-25T08:41:41.489Z] Failed in branch Functionbeat Windows
[2020-08-25T08:41:41.490Z] Failed in branch Journalbeat
[2020-08-25T08:41:41.490Z] Failed in branch Generators Metricbeat Mac OS X
[2020-08-25T08:41:41.491Z] Failed in branch Generators Beat Mac OS X
[2020-08-25T08:41:41.492Z] Failed in branch Kubernetes
[2020-08-25T08:41:41.599Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-08-25T08:41:41.601Z] Stage "Metricbeat x-pack" skipped due to earlier failure(s)
[2020-08-25T08:41:41.602Z] Stage "Generators" skipped due to earlier failure(s)
[2020-08-25T08:41:41.719Z] Failed in branch Metricbeat x-pack
[2020-08-25T08:41:41.719Z] Failed in branch Generators
[2020-08-25T08:41:41.741Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-08-25T08:41:41.817Z] Failed in branch Libbeat
[2020-08-25T08:41:44.894Z] [INFO] unstashV2: JOB_GCS_BUCKET is set. bucket param got precedency instead.
[2020-08-25T08:41:44.914Z] [INFO] unstashV2: JOB_GCS_CREDENTIALS is set. credentialsId param got precedency instead.
[2020-08-25T08:41:44.974Z] [Google Cloud Storage Plugin] Found 1 files to download from pattern: gs://beats-ci-temp/Beats/beats/PR-20739-3/source/source.tgz
[2020-08-25T08:41:45.002Z] [Google Cloud Storage Plugin] Downloading: Beats/beats/PR-20739-3/source/source.tgz to local path: /var/lib/jenkins/workspace/Beats_beats_PR-20739/source.tgz
[2020-08-25T08:41:52.320Z] + tar --version
[2020-08-25T08:41:52.632Z] + tar -xpf source.tgz
[2020-08-25T08:42:02.945Z] + rm source.tgz
[2020-08-25T08:42:02.958Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20739/src/github.com/elastic/beats
[2020-08-25T08:42:02.981Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20739/src/github.com/elastic/beats/Lint
[2020-08-25T08:42:03.426Z] + cat
[2020-08-25T08:42:03.426Z] + /usr/local/bin/runbld ./runbld-script --job-name elastic+beats+pull-request
[2020-08-25T08:42:03.426Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-08-25T08:42:10.008Z] runbld>>> runbld started
[2020-08-25T08:42:10.008Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-08-25T08:42:10.948Z] runbld>>> The following profiles matched the job 'elastic+beats+pull-request' in order of occurrence in the config (last value wins).
[2020-08-25T08:42:10.948Z] runbld>>> Matches in the system config:
[2020-08-25T08:42:10.948Z] runbld>>> - Matched ^elastic\+beats
[2020-08-25T08:42:10.948Z] runbld>>> - Matched ^elastic\+beats\+pull-request
[2020-08-25T08:42:11.889Z] runbld>>> Debug logging enabled.
[2020-08-25T08:42:11.889Z] runbld>>> Storing result
[2020-08-25T08:42:12.149Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-08-25T08:42:12.149Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1597739501209/t/20200825084211-A2DFA4CC
[2020-08-25T08:42:12.149Z] runbld>>> Adding system facts.
[2020-08-25T08:42:13.093Z] runbld>>> Adding vcs info for the latest commit:  a1184cf1ee7f9974146fd6ab358401c1100a5e14
[2020-08-25T08:42:13.093Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-08-25T08:42:13.093Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-08-25T08:42:13.093Z] Processing JUnit reports with runbld...
[2020-08-25T08:42:13.093Z] + echo 'Processing JUnit reports with runbld...'
[2020-08-25T08:42:13.663Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-08-25T08:42:13.664Z] runbld>>> DURATION: 21ms
[2020-08-25T08:42:13.664Z] runbld>>> STDOUT: 40 bytes
[2020-08-25T08:42:13.664Z] runbld>>> STDERR: 49 bytes
[2020-08-25T08:42:13.664Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-08-25T08:42:13.664Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats_PR-20739
[2020-08-25T08:42:14.605Z] runbld>>> Storing build metadata: 
[2020-08-25T08:42:14.605Z] runbld>>> Adding test report.
[2020-08-25T08:42:14.605Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats_PR-20739/src/github.com/elastic/beats
[2020-08-25T08:42:15.175Z] runbld>>> Found 0 test output files
[2020-08-25T08:42:15.175Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 0 Skipped: 0
[2020-08-25T08:42:15.175Z] runbld>>> Storing result
[2020-08-25T08:42:15.435Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-08-25T08:42:15.435Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1597739501209/t/20200825084211-A2DFA4CC
[2020-08-25T08:42:15.695Z] runbld>>> Email notification disabled by environment variable.
[2020-08-25T08:42:15.695Z] runbld>>> Slack notification disabled by environment variable.
[2020-08-25T08:42:21.170Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats_PR-20739
[2020-08-25T08:42:21.273Z] [INFO] getVaultSecret: Getting secrets
[2020-08-25T08:42:21.336Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-08-25T08:42:22.169Z] + chmod 755 generate-build-data.sh
[2020-08-25T08:42:22.170Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20739/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20739/runs/3 FAILURE 502101
[2020-08-25T08:42:22.170Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20739/runs/3/steps/?limit=10000 -o steps-info.json
[2020-08-25T08:42:22.420Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20739/runs/3/tests/?status=FAILED -o tests-errors.json
[2020-08-25T08:42:22.670Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20739/runs/3/log/ -o pipeline-log.txt

@jsoriano
Copy link
Member Author

Closing this, I will continue with #20775 by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Pull request is currently in progress. Team:Platforms Label for the Integrations - Platforms team Team:Services (Deprecated) Label for the former Integrations-Services team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Cache metadata to local disk/db
2 participants