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

Fix unused libbeat.config.module metrics #19168

Merged

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Jun 12, 2020

What does this PR do?

These metrics existed in the code but were unused and hence always 0.

"libbeat":{"config":{"module":{"running":0,"starts":0,"stops":0}

I updated the module reload code to increment and set the metrics when changes are applied.

Why is it important?

If the metrics are exposed by /stats then they should work, otherwise they are misleading.

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.

Logs

I tested the metrics using Auditbeat module reloading:

  "libbeat": {
    "config": {
      "module": {
        "running": 1,
        "starts": 2,
        "stops": 1
      },
      "reloads": 2,
      "scans": 75
    },

@andrewkroh andrewkroh added bug review libbeat Team:Services (Deprecated) Label for the former Integrations-Services team labels Jun 12, 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 Jun 12, 2020
These metrics existed in the code but were unused and hence always 0.

"libbeat":{"config":{"module":{"running":0,"starts":0,"stops":0}

I updated the module reload code to increment and set the metrics when changes are applied.
@andrewkroh andrewkroh force-pushed the bugfix/libbeat/config-module-metrics branch from fdb336e to 629b379 Compare June 12, 2020 16:54
@andrewkroh andrewkroh added the needs_backport PR is waiting to be backported to other branches. label Jun 12, 2020
@andrewkroh andrewkroh marked this pull request as ready for review June 12, 2020 16:54
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 12, 2020

❕ 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: [Branch indexing]

  • Start Time: 2020-06-18T15:15:23.400+0000

  • Duration: 123 min 11 sec

Test stats 🧪

Test Results
Failed 0
Passed 8569
Skipped 1558
Total 10127

Log output

Expand to view the last 100 lines of log output

[2020-06-18T17:18:04.999Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution.access$100(TimeoutStepExecution.java:38)
[2020-06-18T17:18:04.999Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution$1.run(TimeoutStepExecution.java:139)
[2020-06-18T17:18:04.999Z] 	at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
[2020-06-18T17:18:04.999Z] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2020-06-18T17:18:04.999Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-06-18T17:18:04.999Z] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[2020-06-18T17:18:04.999Z] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[2020-06-18T17:18:04.999Z] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-06-18T17:18:04.999Z] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-06-18T17:18:04.999Z] 	at java.lang.Thread.run(Thread.java:748)
[2020-06-18T17:18:04.999Z] 
[2020-06-18T17:18:05.156Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-06-18T17:18:05.174Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Lint
[2020-06-18T17:18:05.347Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Winlogbeat-oss
[2020-06-18T17:18:05.472Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-06-18T17:18:05.610Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Dockerlogbeat
[2020-06-18T17:18:05.723Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-06-18T17:18:05.842Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Journalbeat-oss
[2020-06-18T17:18:05.971Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-06-18T17:18:06.093Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-06-18T17:18:06.201Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-06-18T17:18:06.316Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-06-18T17:18:06.423Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-06-18T17:18:06.535Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Heartbeat-oss
[2020-06-18T17:18:06.673Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-06-18T17:18:06.872Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-06-18T17:18:07.012Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Libbeat-x-pack
[2020-06-18T17:18:07.196Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-06-18T17:18:07.325Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Filebeat-Windows
[2020-06-18T17:18:07.453Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-06-18T17:18:07.616Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-06-18T17:18:07.748Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-06-18T17:18:07.874Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Packetbeat-oss
[2020-06-18T17:18:07.989Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-Windows
[2020-06-18T17:18:08.104Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Filebeat-x-pack
[2020-06-18T17:18:08.215Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-06-18T17:18:08.323Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Filebeat-oss
[2020-06-18T17:18:08.427Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-06-18T17:18:08.536Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-06-18T17:18:08.644Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Libbeat-oss
[2020-06-18T17:18:08.753Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-06-18T17:18:08.874Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Libbeat-crosscompile
[2020-06-18T17:18:08.985Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Libbeat-stress-tests
[2020-06-18T17:18:09.098Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-06-18T17:18:09.217Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-06-18T17:18:09.338Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-06-18T17:18:09.445Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-06-18T17:18:09.552Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-06-18T17:18:09.755Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-06-18T17:18:09.862Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-06-18T17:18:09.983Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-06-18T17:18:10.096Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-06-18T17:18:10.517Z] + cat
[2020-06-18T17:18:10.517Z] + /usr/local/bin/runbld ./runbld-script
[2020-06-18T17:18:10.517Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-06-18T17:18:18.846Z] runbld>>> runbld started
[2020-06-18T17:18:18.846Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-06-18T17:18:19.788Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-19168' in order of occurrence in the config (last value wins).
[2020-06-18T17:18:21.199Z] runbld>>> Debug logging enabled.
[2020-06-18T17:18:21.199Z] runbld>>> Storing result
[2020-06-18T17:18:21.199Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-06-18T17:18:21.199Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200618171820-B02F1C3F
[2020-06-18T17:18:21.199Z] runbld>>> Adding system facts.
[2020-06-18T17:18:22.161Z] runbld>>> Adding vcs info for the latest commit:  9a5392e3e68feab73ac24e8cb65ad0ce541d217c
[2020-06-18T17:18:22.161Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-06-18T17:18:22.161Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-06-18T17:18:22.161Z] Processing JUnit reports with runbld...
[2020-06-18T17:18:22.161Z] + echo 'Processing JUnit reports with runbld...'
[2020-06-18T17:18:22.734Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-06-18T17:18:22.734Z] runbld>>> DURATION: 24ms
[2020-06-18T17:18:22.734Z] runbld>>> STDOUT: 40 bytes
[2020-06-18T17:18:22.734Z] runbld>>> STDERR: 49 bytes
[2020-06-18T17:18:22.734Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-06-18T17:18:22.734Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats
[2020-06-18T17:18:24.231Z] runbld>>> Storing build metadata: 
[2020-06-18T17:18:24.231Z] runbld>>> Adding test report.
[2020-06-18T17:18:24.231Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats
[2020-06-18T17:18:25.619Z] runbld>>> Found 106 test output files
[2020-06-18T17:18:26.191Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-06-18T17:18:26.191Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-06-18T17:18:26.191Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-06-18T17:18:26.191Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-cloudfoundry.xml
[2020-06-18T17:18:26.191Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-06-18T17:18:26.191Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-06-18T17:18:27.149Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-06-18T17:18:27.149Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-06-18T17:18:27.412Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 9977 Skipped: 1321
[2020-06-18T17:18:27.672Z] runbld>>> Storing result
[2020-06-18T17:18:27.672Z] runbld>>> FAILURES: 0
[2020-06-18T17:18:27.932Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-06-18T17:18:27.932Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200618171820-B02F1C3F
[2020-06-18T17:18:27.932Z] runbld>>> Email notification disabled by environment variable.
[2020-06-18T17:18:27.932Z] runbld>>> Slack notification disabled by environment variable.
[2020-06-18T17:18:33.533Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19168
[2020-06-18T17:18:33.673Z] [INFO] getVaultSecret: Getting secrets
[2020-06-18T17:18:33.775Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-06-18T17:18:34.605Z] + chmod 755 generate-build-data.sh
[2020-06-18T17:18:34.605Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19168/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19168/runs/6 ABORTED 7390942
[2020-06-18T17:18:34.605Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19168/runs/6/steps/?limit=10000 -o steps-info.json
[2020-06-18T17:18:37.088Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19168/runs/6/tests/?status=FAILED -o tests-errors.json

}

moduleRunning.Set(int64(len(r.runners)))
Copy link

Choose a reason for hiding this comment

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

Let's add a comment here that the metric is not necessarily correct. The Reload method calls go runner.Stop and immediately removes the runner from the hashtable. But in fact (especially filebeat) the runner/input might still be active for an unknown amount of time (it's a common problem with reconfigured filebeat inputs erroring out on Start).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I guess the original name wasn't necessary the best for this. I added some comments.

@andrewkroh andrewkroh merged commit 5d7e83b into elastic:master Jun 18, 2020
andrewkroh added a commit to andrewkroh/beats that referenced this pull request Jun 18, 2020
These metrics existed in the code but were unused and hence always 0.

"libbeat":{"config":{"module":{"running":0,"starts":0,"stops":0}

I updated the module reload code to increment and set the metrics when changes are applied.

(cherry picked from commit 5d7e83b)
@andrewkroh andrewkroh added v7.9.0 and removed needs_backport PR is waiting to be backported to other branches. labels Jun 18, 2020
andrewkroh added a commit that referenced this pull request Jun 18, 2020
These metrics existed in the code but were unused and hence always 0.

"libbeat":{"config":{"module":{"running":0,"starts":0,"stops":0}

I updated the module reload code to increment and set the metrics when changes are applied.

(cherry picked from commit 5d7e83b)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
These metrics existed in the code but were unused and hence always 0.

"libbeat":{"config":{"module":{"running":0,"starts":0,"stops":0}

I updated the module reload code to increment and set the metrics when changes are applied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug libbeat review Team:Services (Deprecated) Label for the former Integrations-Services team v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants